-
Notifications
You must be signed in to change notification settings - Fork 4
/
0.instagram_get_hashtags.py
30 lines (26 loc) · 1006 Bytes
/
0.instagram_get_hashtags.py
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
import instaloader
import pandas as pd
import numpy as np
L = instaloader.Instaloader(download_pictures=False,
download_video_thumbnails=False,
download_videos=False,
download_geotags=True,
download_comments=False,
save_metadata=False)
def get_it(nameOfExercise):
# Get instance
numbers_of_loop = 1000
while numbers_of_loop > 0:
for post in L.get_hashtag_posts(nameOfExercise):
# post is an instance of instaloader.Post
L.download_post(post, target='#'+nameOfExercise)
numbers_of_loop-=1
# print(numbers_of_loop)
if numbers_of_loop ==0:
break
print("loop ended for " + nameOfExercise)
df = pd.read_csv("./word2vec_wrangling.csv")
kinds_of_exercise = df["exercise_name"].to_list()
print(len(kinds_of_exercise))
for item in kinds_of_exercise:
get_it(item)