def test_from_username(profile):

    expected_profile_username = '******'
    result_profile: Profile = Profile.from_username(username=expected_profile_username)

    assert result_profile.name == profile.data_points[0].username
    assert result_profile.url == profile.url
Beispiel #2
0
def test_from_username():
    expected_profile_usename = "instagram"
    expected_profile_url = f"https://www.instagram.com/{expected_profile_usename}/"

    result_profile: Profile = Profile.from_username(
        username=expected_profile_usename)

    assert result_profile.name == expected_profile_usename
    assert result_profile.url == expected_profile_url
Beispiel #3
0
    def test_from_username(self, page_instance):
        expected_profile_username = "******"
        result_profile: Profile = Profile.from_username(
            username=expected_profile_username)

        assert result_profile.url == page_instance.url
Beispiel #4
0
import json  # import needed libraries / pip3 install json

from instascrape import Profile  # pip3 install insta-scrape

import pandas as pd  # pip3 install pandas

google = Profile.from_username("google")  # declare profile

google.load()  # scrape profile

google_data = google.to_dict()  # turn scraped data into python dictionary

google_data = {key: [val] for key, val in google_data.items()}
df = pd.DataFrame(google_data).transpose()

df.to_csv(
    "google.csv",
    encoding="utf-8")  # convert dataframe to csv and write to "google.csv"
Beispiel #5
0
from instascrape import Profile

user_name = Profile.from_username('pycoders')
user_name.load()

recent = user_name.get_recent_posts()
profile_photos = [post for post in recent if not post.is_video]

for post in profile_photos:
    img = post.upload_date.strftime("%Y-%m-%d %Hh%Mm")
    post.download(f"{img}.png")
import json # import needed libraries / pip3 install json

from instascrape import Profile # pip3 install insta-scrape

import pandas as pd # pip3 install pandas

google = Profile.from_username('google') # declare profile

google.static_load() # scrape profile

google_data = google.data_points[0].to_dict() # turn scraped data into python dictionary

google_data = {key: [val] for key, val in google_data.items()}   
df = pd.DataFrame(google_data)

df.to_csv('google.csv', encoding='utf-8', index=False) # convert dataframe to csv and write to "google.csv"