Skip to content

Commit

Permalink
Update scraper.py
Browse files Browse the repository at this point in the history
  • Loading branch information
weebzone authored Nov 21, 2022
1 parent 605a664 commit c1b624e
Showing 1 changed file with 99 additions and 1 deletion.
100 changes: 99 additions & 1 deletion bot/modules/scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,23 @@
import requests
import re
from re import S
from requests import get
from re import match as rematch, findall, sub as resub
from asyncio import sleep as asleep
from time import sleep
from urllib.parse import urlparse, unquote
from requests import get as rget, head as rhead
from bs4 import BeautifulSoup, NavigableString, Tag

import time
from telegram import Message
from telegram.ext import CommandHandler
from bot import LOGGER, dispatcher, PAID_SERVICE, PAID_USERS, OWNER_ID
from bot.helper.telegram_helper.filters import CustomFilters
from bot.helper.telegram_helper.bot_commands import BotCommands
from bot.helper.telegram_helper.message_utils import sendMessage, editMessage, deleteMessage
from bot.helper.mirror_utils.download_utils.direct_link_generator import rock, try2link, ez4
from bot.helper.ext_utils.exceptions import DirectDownloadLinkException


def scrapper(update, context):
user_id_ = update.message.from_user.id
Expand Down Expand Up @@ -143,6 +147,98 @@ def scrapper(update, context):
prsd = ""
if prsd != "":
sendMessage(prsd, context.bot, update.message)
elif "taemovies" in link:
client = requests.session()
r = client.get(link).text
soup = BeautifulSoup (r, "html.parser")
for a in soup.find_all("a"):
c = a.get("href")
if "shortingly" in c:
link = c
g = rock(link)
t = client.get(g).text
soupt = BeautifulSoup(t, "html.parser")
title = soupt.title
gd_txt = f"{(title.text).replace('GDToT | ' , '')}\n{g}\n\n"
sendMessage(gd_txt,context.bot,update.message)
elif "toonworld4all" in link:
client = requests.session()
r = client.get(link).text
soup = BeautifulSoup (r, "html.parser")
for a in soup.find_all("a"):
c= a.get("href")
if "redirect/main.php?" in c:
download = get(c, stream=True, allow_redirects=False)
link = download.headers["location"]
g = rock(link)
if "gdtot" in g:
t = client.get(g).text
soupt = BeautifulSoup(t, "html.parser")
title = soupt.title
gd_txt = f"{(title.text).replace('GDToT | ' , '')}\n{g}\n\n"
sendMessage(gd_txt,context.bot,update.message)
elif "olamovies" in link:
headers = {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:103.0) Gecko/20100101 Firefox/103.0',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8',
'Accept-Language': 'en-US,en;q=0.5',
'Referer': link,
'Alt-Used': 'olamovies.ink',
'Connection': 'keep-alive',
'Upgrade-Insecure-Requests': '1',
'Sec-Fetch-Dest': 'document',
'Sec-Fetch-Mode': 'navigate',
'Sec-Fetch-Site': 'same-origin',
'Sec-Fetch-User': '?1',
}
client = cloudscraper.create_scraper()
res = client.get(link)
soup = BeautifulSoup(res.text,"html.parser")
soup = soup.findAll("div", class_="wp-block-button")

outlist = []
for ele in soup:
outlist.append(ele.find("a").get("href"))
slist = []
for ele in outlist:
try:
key = ele.split("?key=")[1].split("&id=")[0].replace("%2B","+").replace("%3D","=").replace("%2F","/")
id = ele.split("&id=")[1]
except:
continue
count = 3
params = { 'key': key, 'id': id}
soup = "None"
# print("trying","https://olamovies.wtf/download/&key="+key+"&id="+id)
url = "https://olamovies.wtf/download/&key="+key+"&id="+id
while 'rocklinks.net' not in soup and "try2link.com" not in soup and "ez4short.com" not in soup:
res = client.get("https://olamovies.ink/download/", params=params, headers=headers)
jack = res.text
rose = jack.split('url = "')[-1]
soup = rose.split('";')[0]
if soup != "":
if "try2link.com" in soup:
final = try2link(soup)
t = client.get(final).text
soupt = BeautifulSoup(t, "html.parser")
title = soupt.title
gd_txt = f"{(title.text).replace('GDToT | ' , '')}\n{final}\n\n"
sendMessage(gd_txt, context.bot, update.message)
elif 'rocklinks.net' in soup:
final = rock(soup)
t = client.get(final).text
soupt = BeautifulSoup(t, "html.parser")
title = soupt.title
gd_txt = f"{(title.text).replace('GDToT | ' , '')}\n{final}\n\n"
sendMessage(gd_txt, context.bot, update.message)
elif "ez4short.com" in soup:
final = ez4(soup)
t = client.get(final).text
soupt = BeautifulSoup(t, "html.parser")
title = soupt.title
gd_txt = f"{(title.text).replace('GDToT | ' , '')}\n{final}\n\n"
sendMessage(gd_txt, context.bot, update.message)

else:
res = rget(link)
soup = BeautifulSoup(res.text, 'html.parser')
Expand All @@ -152,6 +248,8 @@ def scrapper(update, context):
for txt in links:
sendMessage(txt, context.bot, update.message)



def htpmovies(link):
client = cloudscraper.create_scraper(allow_brotli=False)
r = client.get(link, allow_redirects=True).text
Expand Down

0 comments on commit c1b624e

Please sign in to comment.