Skip to content

Commit

Permalink
Merge pull request #8 from Datalux/feat/stories
Browse files Browse the repository at this point in the history
feat: add stories command
  • Loading branch information
Datalux authored May 28, 2020
2 parents d0752ca + d89166f commit a01fe29
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
34 changes: 33 additions & 1 deletion Osintgram.py
Original file line number Diff line number Diff line change
Expand Up @@ -694,4 +694,36 @@ def getUserPropic(self):
pc.printout("Target propic saved in output folder\n", pc.GREEN)

else:
pc.printout("Sorry! No results found :-(\n", pc.RED)
pc.printout("Sorry! No results found :-(\n", pc.RED)


def getUserStories(self, id):
pc.printout("Searching for target stories...\n")

endpoint = 'feed/user/{id!s}/story/'.format(**{'id': id})
content = self.api.SendRequest(endpoint)
data = self.api.LastJson
counter = 0

if data['reel'] != None: # no stories avaibile
for i in data['reel']['items']:
story_id = i["id"]
if i["media_type"] == 1: # it's a photo
url = i['image_versions2']['candidates'][0]['url']
end = "output/" + self.target + "_" + story_id + ".jpg"
urllib.request.urlretrieve(url, end)
counter += 1

elif i["media_type"] == 2: # it's a gif or video
url = i['video_versions'][0]['url']
end = "output/" + self.target + "_" + story_id + ".mp4"
urllib.request.urlretrieve(url, end)
counter += 1

if counter > 0:
pc.printout(str(counter) + " target stories saved in output folder\n", pc.GREEN)
else:
pc.printout("Sorry! No results found :-(\n", pc.RED)



6 changes: 5 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ def cmdlist():
print("Get target's posts type (photo or video)")
pc.printout("propic\t\t")
print("Download target's profile picture")
pc.printout("stories\t\t")
print("Download target's sories")


printlogo()
Expand Down Expand Up @@ -105,7 +107,9 @@ def cmdlist():
elif cmd == "mediatype":
api.getMediaType(id)
elif cmd == "propic":
api.getUserPropic()
api.getUserPropic()
elif cmd == "stories":
api.getUserStories(id)

else:
pc.printout("Unknown command\n", pc.RED)
Expand Down

0 comments on commit a01fe29

Please sign in to comment.