def dowload_data(self, username, threshold):
     instagram = Instagram()
     medias = instagram.get_medias(username, threshold)
     dirName = ""
     for media in medias:
         media = instagram.get_media_by_url(media.link)
         image = Image(media)
         dirName = image.saveImage()
     return dirName
Example #2
0
 def dowload_data(self, username, threshold):
     instagram = Instagram()
     medias = instagram.get_medias(username, threshold)
     dirName = ""
     for media in medias:
         QtCore.QCoreApplication.processEvents()
         media = instagram.get_media_by_url(media.link)
         image = Image(media)
         dirName = image.saveImage()
     return dirName
Example #3
0
# likes=likes['accounts']
for account in likes['accounts']:
    print(account.username)


#get comments
print("comments")
comments = instagram.get_media_comments_by_code(code, 10)
for comment in comments['comments']:
    print(comment.text)
    print(comment.owner)


#get media from link
print("get from link")
media = instagram.get_media_by_url('https://www.instagram.com/p/BHaRdodBouH')
print(media)
print(media.owner)


#get media via code
print("media from code")
media = instagram.get_medias_by_code('BHaRdodBouH')

print(media)
print(media.owner)



#get media via ID
media = instagram.get_media_by_id('1270593720437182847')
Example #4
0
medias = instagram.get_medias("target_username", 25)
media = medias[6]

print(media)



https://www.instagram.com/p/CGxmIHLge2w/

# media_links = []
# like_counter = 0 

i = "https://www.instagram.com/p/CHQ5ovQHXS7/"


for i in media_links:
  
  media = instagram.get_media_by_url(i)

  like_counter = media.likes_count + like_counter









Example #5
0
from context import Instagram  # pylint: disable=no-name-in-module

# If account is public you can query Instagram without auth
instagram = Instagram()

# If account is private and you subscribed to it, first login
# instagram.with_credentials('username', 'password', 'cachePath')
# instagram.login()

media = instagram.get_media_by_url(
    'http://api.scraperapi.com?api_key=4c8d7f7e52f92608c210b5ad2b5efde5&url=https://www.instagram.com/p/BHaRdodBouH'
)

print(media)
print(media.owner)
def time_tran(created_at):
    time_local = time.localtime(created_at)
    created_time = time.strftime("%Y-%m-%d %H:%M:%S", time_local)
    return created_time


instagram = Instagram()
# instagram.with_credentials('JJPtest123', 'jjptest', '/pathtocache')
# instagram.login()

# echo "Number of comments: {$medias[0]->get_comments_count()}\n";
# echo "Fetched: " . count($comments) . "\n";
# or by id
print('begin...')
# media = instagram.get_media_by_url('https://www.instagram.com/p/BhzelQ5lCi2/')
media = instagram.get_media_by_url('https://www.instagram.com/p/BhwuJcmlWh8/')
print('get media success...')
# short_code = media.get_short_code()
# print('short_code: ', short_code)
# id = media.get_id_from_code(short_code)
# print('id: ', id)
# print(media.comments)
f = open('E:\instagram-scraper\examples\data_new\\' + media.get_short_code() +
         ' .csv',
         'w',
         encoding="utf-8")
f.write(" https://www.instagram.com/p/" + media.get_short_code() + "/   ")
f.write('\n')
f.write(time_tran(media.get_media_created_time()))
f.write('\n')
# time.sleep(5)