[Tutor] Code correction
Rajesh Koot
rajeshkoot190 at gmail.com
Sat Oct 2 08:11:00 EDT 2021
below is a code attached to scrape videos from instagram groups we are
following
Can you please tell me which all fields are needed to fill other than
username and password
# scrape_videos.py scrapes all the videos from pages we are following
def scrapeVideos(username = "",
password = "",
output_folder = "",
days = 1):
print("Starting Scraping")
L = instaloader.Instaloader()
# Login or load session for loader
L.login(username, password)
profile = instaloader.Profile.from_username(L.context, username)
following = profile.get_followees()
print(following)
for profile in following:
acc = profile.username
looter = ProfileLooter(acc, videos_only=True,
template="{id}-{username}-{width}-{height}")
if not looter.logged_in():
looter.login(username, password)
print("Scraping From Account: " + acc)
today = datetime.date.today()
timeframe = (today, today -
dateutil.relativedelta.relativedelta(days=days))
numDowloaded = looter.download(output_folder, media_count=30,
timeframe=timeframe)
print("Downloaded " + str(numDowloaded) + " videos successfully")
print("")
More information about the Tutor
mailing list