Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Several Naming Fixes for Netflix and Amazon #13

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion netflix.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,29 @@ def getTitle(self):
s = self.soupObject.find("meta", attrs={"name": "twitter:title"})
self.title = str(s['content'])
self.title = self.title.strip()
temp_title = self.title.split()
if temp_title[0]=='Watch' or temp[0] == "watch":
self.title = ' '.join(self.title.split()[1:])
self.title = self.title.replace(" Online | Netflix","")
if not self.title:
s = int("deliberateError")

except:
self.title = "Netflixsubtitles"

try:
#<meta property="og:title" content="Watch House of Cards Online | Netflix"/>
s = self.soupObject.find("meta", attrs={"property": "og:title"})
self.title = str(s['content'])
self.title = self.title.strip()
temp_title = self.title.split()
if temp_title[0]=='Watch' or temp[0] == "watch":
self.title = ' '.join(self.title.split()[1:])
self.title = self.title.replace(" Online | Netflix","")
if not self.title:
s = int("deliberateError")

except:
self.title = "Netflixsubtitles"

pass

Expand Down
26 changes: 23 additions & 3 deletions newamazon.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,9 @@ def getTitle(self):
"""
This function returns the title of the video. This is also used for naming the file.

<meta name="twitter:title" content="Interstellar"/> --> Extracting the value from here
<meta name="twitter:title" content=" Watch Defiance Season 1 Episode - Amazon Video"/> --> Extracting the value from here
OR
<meta property="og:title" content="Watch Defiance Season 1 Episode - Amazon Video"/> --> Extracting the value from here

"""

Expand All @@ -344,13 +346,31 @@ def getTitle(self):
s = self.soupObject.find("meta", attrs={"name": "twitter:title"})
self.title = str(s['content'])
self.title = self.title.replace("/", "")
temp_title = self.title.split()
if temp_title[0]=='Watch' or temp[0] == "watch":
self.title = ' '.join(self.title.split()[1:])
self.title = self.title.replace("- Amazon Video","")
self.title = self.title.strip()
if not self.title:
s = int("deliberateError")

# except
except:
self.title = "Amazonsubtitles"

try:
s = self.soupObject.find("meta", attrs={"property": "og:title"})
self.title = str(s['content'])
self.title = self.title.replace("/", "")
temp_title = self.title.split()
if temp_title[0]=='Watch' or temp[0] == "watch":
self.title = ' '.join(self.title.split()[1:])
self.title = self.title.replace("- Amazon Video","")
self.title = self.title.strip()
if not self.title:
s = int("deliberateError")

except:
self.title = "Amazonsubtitles"

pass

Expand Down Expand Up @@ -388,4 +408,4 @@ def standardFunctionCalls(self):
self.deleteUnnecessaryfiles()

return returnValue
pass
pass