Skip to content

Commit

Permalink
fix source
Browse files Browse the repository at this point in the history
  • Loading branch information
datawhores committed Aug 20, 2024
1 parent c9f1164 commit 0f0681e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions ofscraper/classes/media.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,24 +89,25 @@ def url(self):
if self.protected is True:
return None
elif self._final_url:
None
return self._final_url
elif self.responsetype == "stories" or self.responsetype == "highlights":
self._final_url = self.files_source.get("full")
elif self.responsetype == "profile":
self._final_url = self._media.get("url")
else:
self._final_url = self._url_source_helper()
self._final_url = self._url_quality_picker()
return self._final_url

def _url_source_helper(self):
def _url_quality_picker(self):
quality = self.normal_quality_helper()
out=None
if quality != "source":
out=self._media.get("videoSources", {}).get(quality)
elif out is None:
out=self.files_source.get("full")

elif out is None:
out=self._media.get("source", {}).get("source")
out=self.media_source.get("source")
return out


Expand Down Expand Up @@ -460,7 +461,7 @@ def protected(self):
return False
elif bool(self.media_source.get("source")):
return False
elif bool(self.files_source):
elif bool(self.files_source.get("full")):
return False
return True

Expand Down

0 comments on commit 0f0681e

Please sign in to comment.