Skip to content

Instantly share code, notes, and snippets.

@ivanelianto
Last active November 13, 2019 12:56
Show Gist options
  • Save ivanelianto/41733ccf8bd10e8edb4bd0f59e8ed612 to your computer and use it in GitHub Desktop.
Save ivanelianto/41733ccf8bd10e8edb4bd0f59e8ed612 to your computer and use it in GitHub Desktop.
Not working anymore after patch in the website.
'''
NOT WORKING ANYMORE. THE WEBSITE HAS BEEN PATCHED.
'''
import requests
from bs4 import BeautifulSoup
import webbrowser as wb
import itertools
print 'Please wait'
# Windows
chrome_path = 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s'
url = "https://dramaday.net/angels-last-mission-love/"
'''
0 = 1080p NEXT
2 = 720p NEXT
4 = 720p x265
6 = 540p x264
8 = 1080p WEB-DL <-- Current
10 = 720p WEB-DL
12 = 540p WEB-DL
'''
PREFFERED_DOWNLOAD_SOURCE = 8
TOTAL_EPISODE = 16
'''
+1 Episode Start with Format C1, C2 and so on...
+1 Again Because xrange(inclusive, EXCLUSIVE)
'''
TOTAL_EPISODE_OFFSET = 2
webpage = requests.get(url)
if webpage.status_code == 200:
soup = BeautifulSoup(webpage.content, 'html.parser')
for i in xrange(TOTAL_EPISODE_OFFSET, TOTAL_EPISODE_OFFSET + TOTAL_EPISODE):
tds = soup.findAll("td", {"data-cell-id": ("C%d" % i)})
for td in tds:
links = td["data-original-value"]
links = list(itertools.chain.from_iterable(link.split("<br>") for link in links.split(" | ")))
link = BeautifulSoup(links[PREFFERED_DOWNLOAD_SOURCE], 'html.parser').find('a').get('href', '')
wb.get(chrome_path).open_new_tab(link)
print 'All links opened'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment