File size: 27,108 Bytes
8ed9c94
 
 
 
 
 
 
 
 
 
 
 
39fded5
8ed9c94
 
 
 
6a3527b
8ed9c94
6a3527b
39fded5
 
8ed9c94
 
 
 
 
 
 
 
 
 
 
 
39fded5
8ed9c94
 
 
 
d94f83a
 
 
 
 
 
 
8ed9c94
 
 
 
39fded5
a2b888f
8ed9c94
a2b888f
 
d94f83a
c5c6036
a2b888f
 
 
 
39fded5
d94f83a
8ed9c94
 
 
a2b888f
 
 
c5c6036
a2b888f
d94f83a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39fded5
d94f83a
 
 
 
 
 
 
 
 
c5c6036
 
 
 
 
d94f83a
c5c6036
d94f83a
 
 
 
c5c6036
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d94f83a
 
 
 
c5c6036
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d94f83a
c5c6036
 
 
 
 
 
d94f83a
c5c6036
 
d94f83a
c5c6036
 
 
 
 
 
 
 
 
 
d94f83a
 
 
 
c5c6036
 
 
 
 
 
d94f83a
 
 
 
 
 
c5c6036
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d94f83a
c5c6036
d94f83a
 
 
 
 
 
 
 
 
c5c6036
 
 
 
 
d94f83a
c5c6036
 
 
 
 
 
d94f83a
c5c6036
 
 
 
 
 
d94f83a
 
c5c6036
d94f83a
 
8ed9c94
 
 
c5c6036
 
8ed9c94
 
 
 
c5c6036
d94f83a
8ed9c94
a2b888f
 
 
 
 
c5c6036
a2b888f
d94f83a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39fded5
d94f83a
 
 
 
 
 
 
 
c5c6036
 
 
 
 
 
 
 
 
 
 
 
d94f83a
c5c6036
 
 
 
 
 
 
 
 
 
 
 
d94f83a
 
 
 
39fded5
d94f83a
c5c6036
d94f83a
 
 
 
c5c6036
d94f83a
 
 
 
39fded5
d94f83a
c5c6036
d94f83a
 
 
 
c5c6036
d94f83a
 
 
 
39fded5
d94f83a
 
 
 
 
 
 
 
 
 
 
c5c6036
 
 
 
 
d94f83a
c5c6036
 
 
 
 
 
d94f83a
 
c5c6036
 
 
 
 
d94f83a
 
c5c6036
d94f83a
 
a2b888f
 
6a3527b
c5c6036
d94f83a
6a3527b
 
 
 
c5c6036
d94f83a
6a3527b
c5c6036
 
 
 
 
 
 
 
 
 
 
a2b888f
 
 
 
 
d94f83a
a2b888f
 
 
d94f83a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39fded5
d94f83a
 
 
 
 
 
 
 
 
 
 
 
 
39fded5
d94f83a
 
 
 
 
 
 
 
 
 
 
39fded5
d94f83a
c5c6036
d94f83a
 
 
 
 
 
 
 
 
39fded5
d94f83a
c5c6036
d94f83a
 
 
 
 
 
 
 
 
39fded5
d94f83a
 
 
 
 
 
 
 
 
 
 
39fded5
d94f83a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39fded5
 
c5c6036
 
39fded5
 
 
 
 
 
 
 
 
d94f83a
 
c5c6036
d94f83a
 
a2b888f
 
8ed9c94
c5c6036
 
8ed9c94
 
 
 
c5c6036
 
8ed9c94
39fded5
 
c5c6036
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39fded5
 
c5c6036
 
 
 
 
 
 
 
 
 
 
d94f83a
39fded5
 
 
d94f83a
39fded5
 
 
 
 
 
 
 
8ed9c94
 
 
 
6a3527b
8ed9c94
 
 
 
 
 
 
 
 
 
 
 
 
 
6a3527b
 
 
 
 
8ed9c94
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "a5361789",
   "metadata": {},
   "source": [
    "## Have to install these packages \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "c9021300",
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "%%capture \n",
    "!pip3 install Twint \n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5c857dbf",
   "metadata": {},
   "source": [
    "## Nessessary Imports"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "1413ab2b",
   "metadata": {},
   "outputs": [],
   "source": [
    "import asyncio\n",
    "import os\n",
    "loop = asyncio.get_event_loop()\n",
    "loop.is_running()\n",
    "import twint\n",
    "import nest_asyncio\n",
    "nest_asyncio.apply()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "d38514f3",
   "metadata": {},
   "outputs": [],
   "source": [
    "import scrape\n",
    "sc= scrape.TwitterScraper(num_tweets=10)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "d37e5cbf",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[+] Finished: Successfully collected 20 Tweets.\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>tweet</th>\n",
       "      <th>date</th>\n",
       "      <th>user_id</th>\n",
       "      <th>username</th>\n",
       "      <th>urls</th>\n",
       "      <th>nlikes</th>\n",
       "      <th>nreplies</th>\n",
       "      <th>nretweets</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1545194541006950400</td>\n",
       "      <td>kim sever benim gibi sevmeyecekler bıraktığın ...</td>\n",
       "      <td>2022-07-08 01:54:21</td>\n",
       "      <td>1396065566117466113</td>\n",
       "      <td>heja4r</td>\n",
       "      <td>[]</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1545192735354806274</td>\n",
       "      <td>Kelimeler,albayım,bazı anlamalara gelmiyor..</td>\n",
       "      <td>2022-07-08 01:47:11</td>\n",
       "      <td>1481604485118140425</td>\n",
       "      <td>Theguapo6</td>\n",
       "      <td>[]</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1545190168533008385</td>\n",
       "      <td>@shikan213 ptdr ? y’a aucune racisme à quel mo...</td>\n",
       "      <td>2022-07-08 01:36:59</td>\n",
       "      <td>1476042813741617155</td>\n",
       "      <td>srndz213__</td>\n",
       "      <td>[]</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1545190106910171136</td>\n",
       "      <td>@guzzeida Men gud du har presterat så mkt bätt...</td>\n",
       "      <td>2022-07-08 01:36:44</td>\n",
       "      <td>34343541</td>\n",
       "      <td>lisaxamanda</td>\n",
       "      <td>[]</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1545190096042860544</td>\n",
       "      <td>Heja, heja, heja Slovensko</td>\n",
       "      <td>2022-07-08 01:36:41</td>\n",
       "      <td>3158344237</td>\n",
       "      <td>ian_10_19</td>\n",
       "      <td>[]</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                    id                                              tweet  \\\n",
       "0  1545194541006950400  kim sever benim gibi sevmeyecekler bıraktığın ...   \n",
       "1  1545192735354806274       Kelimeler,albayım,bazı anlamalara gelmiyor..   \n",
       "2  1545190168533008385  @shikan213 ptdr ? y’a aucune racisme à quel mo...   \n",
       "3  1545190106910171136  @guzzeida Men gud du har presterat så mkt bätt...   \n",
       "4  1545190096042860544                         Heja, heja, heja Slovensko   \n",
       "\n",
       "                  date              user_id     username urls  nlikes  \\\n",
       "0  2022-07-08 01:54:21  1396065566117466113       heja4r   []       1   \n",
       "1  2022-07-08 01:47:11  1481604485118140425    Theguapo6   []       1   \n",
       "2  2022-07-08 01:36:59  1476042813741617155   srndz213__   []       0   \n",
       "3  2022-07-08 01:36:44             34343541  lisaxamanda   []       1   \n",
       "4  2022-07-08 01:36:41           3158344237    ian_10_19   []       0   \n",
       "\n",
       "   nreplies  nretweets  \n",
       "0         0          0  \n",
       "1         0          0  \n",
       "2         1          0  \n",
       "3         0          0  \n",
       "4         0          0  "
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "string_tr_info=sc.scrape_by_string(\"heja\")\n",
    "string_tr_info.head()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "902170ad",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>tweet</th>\n",
       "      <th>date</th>\n",
       "      <th>user_id</th>\n",
       "      <th>username</th>\n",
       "      <th>urls</th>\n",
       "      <th>nlikes</th>\n",
       "      <th>nreplies</th>\n",
       "      <th>nretweets</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1545194541006950400</td>\n",
       "      <td>kim sever benim gibi sevmeyecekler bıraktığın ...</td>\n",
       "      <td>2022-07-08 01:54:21</td>\n",
       "      <td>1396065566117466113</td>\n",
       "      <td>heja4r</td>\n",
       "      <td>[]</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1545192735354806274</td>\n",
       "      <td>Kelimeler,albayım,bazı anlamalara gelmiyor..</td>\n",
       "      <td>2022-07-08 01:47:11</td>\n",
       "      <td>1481604485118140425</td>\n",
       "      <td>Theguapo6</td>\n",
       "      <td>[]</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1545190096042860544</td>\n",
       "      <td>Heja, heja, heja Slovensko</td>\n",
       "      <td>2022-07-08 01:36:41</td>\n",
       "      <td>3158344237</td>\n",
       "      <td>ian_10_19</td>\n",
       "      <td>[]</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>1545189783747436545</td>\n",
       "      <td>Beni sorarsan dardayım..</td>\n",
       "      <td>2022-07-08 01:35:27</td>\n",
       "      <td>1481604485118140425</td>\n",
       "      <td>Theguapo6</td>\n",
       "      <td>[]</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>1545186234623991813</td>\n",
       "      <td>Heja strandhäll.  Vilket jävla block mongo</td>\n",
       "      <td>2022-07-08 01:21:21</td>\n",
       "      <td>1160537136250195968</td>\n",
       "      <td>Siggydunn</td>\n",
       "      <td>[]</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                     id                                              tweet  \\\n",
       "0   1545194541006950400  kim sever benim gibi sevmeyecekler bıraktığın ...   \n",
       "1   1545192735354806274       Kelimeler,albayım,bazı anlamalara gelmiyor..   \n",
       "4   1545190096042860544                         Heja, heja, heja Slovensko   \n",
       "6   1545189783747436545                           Beni sorarsan dardayım..   \n",
       "12  1545186234623991813         Heja strandhäll.  Vilket jävla block mongo   \n",
       "\n",
       "                   date              user_id   username urls  nlikes  \\\n",
       "0   2022-07-08 01:54:21  1396065566117466113     heja4r   []       1   \n",
       "1   2022-07-08 01:47:11  1481604485118140425  Theguapo6   []       1   \n",
       "4   2022-07-08 01:36:41           3158344237  ian_10_19   []       0   \n",
       "6   2022-07-08 01:35:27  1481604485118140425  Theguapo6   []       2   \n",
       "12  2022-07-08 01:21:21  1160537136250195968  Siggydunn   []       0   \n",
       "\n",
       "    nreplies  nretweets  \n",
       "0          0          0  \n",
       "1          0          0  \n",
       "4          0          0  \n",
       "6          0          0  \n",
       "12         0          0  "
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "string_t_info=sc.get_only_tweets(tr_info)\n",
    "string_t_info.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "a7912a91",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[+] Finished: Successfully collected 20 Tweets.\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>tweet</th>\n",
       "      <th>date</th>\n",
       "      <th>user_id</th>\n",
       "      <th>username</th>\n",
       "      <th>urls</th>\n",
       "      <th>nlikes</th>\n",
       "      <th>nreplies</th>\n",
       "      <th>nretweets</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1544748873767424001</td>\n",
       "      <td>Fruktansvärt att nås av beskedet att kvinnan s...</td>\n",
       "      <td>2022-07-06 20:23:26</td>\n",
       "      <td>95972673</td>\n",
       "      <td>jimmieakesson</td>\n",
       "      <td>[]</td>\n",
       "      <td>3397</td>\n",
       "      <td>167</td>\n",
       "      <td>140</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1538948369611210764</td>\n",
       "      <td>@annieloof Nej, jag håller med. Tänk mer som M...</td>\n",
       "      <td>2022-06-20 20:14:18</td>\n",
       "      <td>95972673</td>\n",
       "      <td>jimmieakesson</td>\n",
       "      <td>[]</td>\n",
       "      <td>1513</td>\n",
       "      <td>89</td>\n",
       "      <td>115</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1537770920621879297</td>\n",
       "      <td>Man kan ha synpunkter på en sådan lösning, men...</td>\n",
       "      <td>2022-06-17 14:15:32</td>\n",
       "      <td>95972673</td>\n",
       "      <td>jimmieakesson</td>\n",
       "      <td>[]</td>\n",
       "      <td>694</td>\n",
       "      <td>17</td>\n",
       "      <td>41</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1537770809225273344</td>\n",
       "      <td>Är det ont om plats på anstalterna så får man ...</td>\n",
       "      <td>2022-06-17 14:15:05</td>\n",
       "      <td>95972673</td>\n",
       "      <td>jimmieakesson</td>\n",
       "      <td>[]</td>\n",
       "      <td>810</td>\n",
       "      <td>26</td>\n",
       "      <td>57</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1537770713368735744</td>\n",
       "      <td>Döms man för brott, särskilt våldsbrott, ska m...</td>\n",
       "      <td>2022-06-17 14:14:43</td>\n",
       "      <td>95972673</td>\n",
       "      <td>jimmieakesson</td>\n",
       "      <td>[]</td>\n",
       "      <td>1020</td>\n",
       "      <td>26</td>\n",
       "      <td>86</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                    id                                              tweet  \\\n",
       "0  1544748873767424001  Fruktansvärt att nås av beskedet att kvinnan s...   \n",
       "1  1538948369611210764  @annieloof Nej, jag håller med. Tänk mer som M...   \n",
       "2  1537770920621879297  Man kan ha synpunkter på en sådan lösning, men...   \n",
       "3  1537770809225273344  Är det ont om plats på anstalterna så får man ...   \n",
       "4  1537770713368735744  Döms man för brott, särskilt våldsbrott, ska m...   \n",
       "\n",
       "                  date   user_id       username urls  nlikes  nreplies  \\\n",
       "0  2022-07-06 20:23:26  95972673  jimmieakesson   []    3397       167   \n",
       "1  2022-06-20 20:14:18  95972673  jimmieakesson   []    1513        89   \n",
       "2  2022-06-17 14:15:32  95972673  jimmieakesson   []     694        17   \n",
       "3  2022-06-17 14:15:05  95972673  jimmieakesson   []     810        26   \n",
       "4  2022-06-17 14:14:43  95972673  jimmieakesson   []    1020        26   \n",
       "\n",
       "   nretweets  \n",
       "0        140  \n",
       "1        115  \n",
       "2         41  \n",
       "3         57  \n",
       "4         86  "
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "user__tr_info=sc.scrape_by_user(\"jimmieakesson\")\n",
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7db69757",
   "metadata": {},
   "outputs": [],
   "source": [
    "user__t_info=sc.get_only_tweets(tr_info)\n",
    "user__t_info.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "9d6b1bdf",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[+] Finished: Successfully collected 16 Tweets from @jimmieakesson.\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>tweet</th>\n",
       "      <th>date</th>\n",
       "      <th>user_id</th>\n",
       "      <th>username</th>\n",
       "      <th>urls</th>\n",
       "      <th>nlikes</th>\n",
       "      <th>nreplies</th>\n",
       "      <th>nretweets</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1363067834260201475</td>\n",
       "      <td>Utan massiv, asylrelaterad invandring från frä...</td>\n",
       "      <td>2021-02-20 11:07:50</td>\n",
       "      <td>95972673</td>\n",
       "      <td>jimmieakesson</td>\n",
       "      <td>[]</td>\n",
       "      <td>1277</td>\n",
       "      <td>22</td>\n",
       "      <td>105</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1363067613660778496</td>\n",
       "      <td>Många vänsterliberaler tycks ha reagerat på de...</td>\n",
       "      <td>2021-02-20 11:06:58</td>\n",
       "      <td>95972673</td>\n",
       "      <td>jimmieakesson</td>\n",
       "      <td>[]</td>\n",
       "      <td>625</td>\n",
       "      <td>9</td>\n",
       "      <td>68</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1363067558409158656</td>\n",
       "      <td>Jag förstår — uppriktigt — inte den närmast hy...</td>\n",
       "      <td>2021-02-20 11:06:45</td>\n",
       "      <td>95972673</td>\n",
       "      <td>jimmieakesson</td>\n",
       "      <td>[]</td>\n",
       "      <td>2458</td>\n",
       "      <td>199</td>\n",
       "      <td>336</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1362748777552113670</td>\n",
       "      <td>Invandring av hundratusentals människor från f...</td>\n",
       "      <td>2021-02-19 14:00:01</td>\n",
       "      <td>95972673</td>\n",
       "      <td>jimmieakesson</td>\n",
       "      <td>[]</td>\n",
       "      <td>1334</td>\n",
       "      <td>55</td>\n",
       "      <td>101</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1362409505557012490</td>\n",
       "      <td>Vårt land behöver ett totalstopp för all asyl-...</td>\n",
       "      <td>2021-02-18 15:31:53</td>\n",
       "      <td>95972673</td>\n",
       "      <td>jimmieakesson</td>\n",
       "      <td>[]</td>\n",
       "      <td>3044</td>\n",
       "      <td>268</td>\n",
       "      <td>404</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                    id                                              tweet  \\\n",
       "0  1363067834260201475  Utan massiv, asylrelaterad invandring från frä...   \n",
       "1  1363067613660778496  Många vänsterliberaler tycks ha reagerat på de...   \n",
       "2  1363067558409158656  Jag förstår — uppriktigt — inte den närmast hy...   \n",
       "3  1362748777552113670  Invandring av hundratusentals människor från f...   \n",
       "4  1362409505557012490  Vårt land behöver ett totalstopp för all asyl-...   \n",
       "\n",
       "                  date   user_id       username urls  nlikes  nreplies  \\\n",
       "0  2021-02-20 11:07:50  95972673  jimmieakesson   []    1277        22   \n",
       "1  2021-02-20 11:06:58  95972673  jimmieakesson   []     625         9   \n",
       "2  2021-02-20 11:06:45  95972673  jimmieakesson   []    2458       199   \n",
       "3  2021-02-19 14:00:01  95972673  jimmieakesson   []    1334        55   \n",
       "4  2021-02-18 15:31:53  95972673  jimmieakesson   []    3044       268   \n",
       "\n",
       "   nretweets  \n",
       "0        105  \n",
       "1         68  \n",
       "2        336  \n",
       "3        101  \n",
       "4        404  "
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "user__string_tr_info=sc.scrape_by_user_and_string(\"jimmieakesson\",\"invandring\")\n",
    "user__string_tr_info.head()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "a1aede79",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>tweet</th>\n",
       "      <th>date</th>\n",
       "      <th>user_id</th>\n",
       "      <th>username</th>\n",
       "      <th>urls</th>\n",
       "      <th>nlikes</th>\n",
       "      <th>nreplies</th>\n",
       "      <th>nretweets</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1363067834260201475</td>\n",
       "      <td>Utan massiv, asylrelaterad invandring från frä...</td>\n",
       "      <td>2021-02-20 11:07:50</td>\n",
       "      <td>95972673</td>\n",
       "      <td>jimmieakesson</td>\n",
       "      <td>[]</td>\n",
       "      <td>1277</td>\n",
       "      <td>22</td>\n",
       "      <td>105</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1363067613660778496</td>\n",
       "      <td>Många vänsterliberaler tycks ha reagerat på de...</td>\n",
       "      <td>2021-02-20 11:06:58</td>\n",
       "      <td>95972673</td>\n",
       "      <td>jimmieakesson</td>\n",
       "      <td>[]</td>\n",
       "      <td>625</td>\n",
       "      <td>9</td>\n",
       "      <td>68</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1363067558409158656</td>\n",
       "      <td>Jag förstår — uppriktigt — inte den närmast hy...</td>\n",
       "      <td>2021-02-20 11:06:45</td>\n",
       "      <td>95972673</td>\n",
       "      <td>jimmieakesson</td>\n",
       "      <td>[]</td>\n",
       "      <td>2458</td>\n",
       "      <td>199</td>\n",
       "      <td>336</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1362748777552113670</td>\n",
       "      <td>Invandring av hundratusentals människor från f...</td>\n",
       "      <td>2021-02-19 14:00:01</td>\n",
       "      <td>95972673</td>\n",
       "      <td>jimmieakesson</td>\n",
       "      <td>[]</td>\n",
       "      <td>1334</td>\n",
       "      <td>55</td>\n",
       "      <td>101</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1362409505557012490</td>\n",
       "      <td>Vårt land behöver ett totalstopp för all asyl-...</td>\n",
       "      <td>2021-02-18 15:31:53</td>\n",
       "      <td>95972673</td>\n",
       "      <td>jimmieakesson</td>\n",
       "      <td>[]</td>\n",
       "      <td>3044</td>\n",
       "      <td>268</td>\n",
       "      <td>404</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                    id                                              tweet  \\\n",
       "0  1363067834260201475  Utan massiv, asylrelaterad invandring från frä...   \n",
       "1  1363067613660778496  Många vänsterliberaler tycks ha reagerat på de...   \n",
       "2  1363067558409158656  Jag förstår — uppriktigt — inte den närmast hy...   \n",
       "3  1362748777552113670  Invandring av hundratusentals människor från f...   \n",
       "4  1362409505557012490  Vårt land behöver ett totalstopp för all asyl-...   \n",
       "\n",
       "                  date   user_id       username urls  nlikes  nreplies  \\\n",
       "0  2021-02-20 11:07:50  95972673  jimmieakesson   []    1277        22   \n",
       "1  2021-02-20 11:06:58  95972673  jimmieakesson   []     625         9   \n",
       "2  2021-02-20 11:06:45  95972673  jimmieakesson   []    2458       199   \n",
       "3  2021-02-19 14:00:01  95972673  jimmieakesson   []    1334        55   \n",
       "4  2021-02-18 15:31:53  95972673  jimmieakesson   []    3044       268   \n",
       "\n",
       "   nretweets  \n",
       "0        105  \n",
       "1         68  \n",
       "2        336  \n",
       "3        101  \n",
       "4        404  "
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "user__string_t_info = sc.get_only_tweets(user__string_tr_info)\n",
    "user__string_t_info.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "48d50b46",
   "metadata": {},
   "outputs": [],
   "source": [
    "tweets= df[\"tweet\"]\n",
    "for tweet in tweets:\n",
    "    print(tweet, \"\\n\", \"__________________________________________________________\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "530c26e2",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3.10.4 64-bit",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.4"
  },
  "vscode": {
   "interpreter": {
    "hash": "916dbcbb3f70747c44a77c7bcd40155683ae19c65e1c03b4aa3499c5328201f1"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}