├── .circleci
└── config.yml
├── Procfile
├── README.md
├── install.sh
├── main.py
├── modules
├── .gitkeep
├── Server.py
├── Session.py
├── Utilities.py
├── users
│ ├── .gitkeep
│ └── Users.py
└── video
│ ├── .gitkeep
│ ├── VideoClasses.py
│ ├── categories
│ ├── .gitkeep
│ └── Video_categoriesClasses.py
│ ├── pageScrape
│ ├── .gitkeep
│ └── searchPage.py
│ └── video_actions.py
├── requirements.txt
└── users_files
└── .gitkeep
/.circleci/config.yml:
--------------------------------------------------------------------------------
1 | # Use the latest 2.1 version of CircleCI pipeline process engine.
2 | # See: https://circleci.com/docs/2.0/configuration-reference
3 | version: 2.1
4 |
5 | # Orbs are reusable packages of CircleCI configuration that you may share across projects, enabling you to create encapsulated, parameterized commands, jobs, and executors that can be used across multiple projects.
6 | # See: https://circleci.com/docs/2.0/orb-intro/
7 | orbs:
8 | # The python orb contains a set of prepackaged CircleCI configuration you can use repeatedly in your configuration files
9 | # Orb commands and jobs help you with common scripting around a language/tool
10 | # so you dont have to copy and paste it everywhere.
11 | # See the orb documentation here: https://circleci.com/developer/orbs/orb/circleci/python
12 | python: circleci/python@1.5.0
13 |
14 | # Define a job to be invoked later in a workflow.
15 | # See: https://circleci.com/docs/2.0/configuration-reference/#jobs
16 | jobs:
17 | build-and-test: # This is the name of the job, feel free to change it to better match what you're trying to do!
18 | # These next lines defines a Docker executors: https://circleci.com/docs/2.0/executor-types/
19 | # You can specify an image from Dockerhub or use one of the convenience images from CircleCI's Developer Hub
20 | # A list of available CircleCI Docker convenience images are available here: https://circleci.com/developer/images/image/cimg/python
21 | # The executor is the environment in which the steps below will be executed - below will use a python 3.10.2 container
22 | # Change the version below to your required version of python
23 | docker:
24 | - image: cimg/python:3.10.2
25 | # Checkout the code as the first step. This is a dedicated CircleCI step.
26 | # The python orb's install-packages step will install the dependencies from a Pipfile via Pipenv by default.
27 | # Here we're making sure we use just use the system-wide pip. By default it uses the project root's requirements.txt.
28 | # Then run your tests!
29 | # CircleCI will report the results back to your VCS provider.
30 | steps:
31 | - checkout
32 | - restore_cache:
33 | keys:
34 | - v1-dependencies-{{ checksum "requirements.txt" }}
35 | # fallback to using the latest cache if no exact match is found
36 | - v1-dependencies-
37 |
38 | - save_cache:
39 | paths:
40 | - ./venv
41 | key: v1-dependencies-{{ checksum "requirements.txt" }}
42 |
43 | - python/install-packages:
44 | pkg-manager: pip
45 | # app-dir: ~/project/package-directory/ # If you're requirements.txt isn't in the root directory.
46 | pip-dependency-file: requirements.txt # if you have a different name for your requirements file, maybe one that combines your runtime and test requirements.
47 | - run:
48 | name: Run tests
49 | # This assumes pytest is installed via the install-package step above
50 | command: python3 main.py
51 |
52 | # Invoke jobs via workflows
53 | # See: https://circleci.com/docs/2.0/configuration-reference/#workflows
54 | workflows:
55 | sample: # This is the name of the workflow, feel free to change it to better match your workflow.
56 | # Inside the workflow, you define the jobs you want to run.
57 | jobs:
58 | - build-and-test
59 |
--------------------------------------------------------------------------------
/Procfile:
--------------------------------------------------------------------------------
1 | Worker: chmod 777 install.sh ; ./install.sh
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # FavePorn
2 | PornHub Crawler for Telegram
3 |
4 | A Telegram Bot for searching and downloading all ( non premium ) pornhub videos for free
5 |
6 |
--------------------------------------------------------------------------------
/install.sh:
--------------------------------------------------------------------------------
1 | heroku addons:create proximo:development
2 | pip install --upgrade pip
3 | pip install pur
4 | pip install requests
5 | pur -r requirements.txt
6 | pip install python-telegram-bot==13
7 | python3 main.py
8 |
--------------------------------------------------------------------------------
/main.py:
--------------------------------------------------------------------------------
1 | from telegram.ext import Updater
2 | from telegram.ext import CommandHandler, CallbackQueryHandler
3 | from telegram.ext import MessageHandler, Filters
4 | import modules.Server as Server
5 | from modules.Session import Session
6 | import modules.video.video_actions as video_actions
7 | #import modules.pics.pics_actions as pics_actions
8 | import datetime
9 |
10 |
11 | def start_session( update, context):
12 | Server.sessions[ update.effective_chat.id]= Session( update, context)
13 |
14 | def controller_command( update, context):
15 | command= update.message.text
16 | out= ""
17 |
18 |
19 | if( command== '/teston'):
20 | Server.isTesting= True
21 | out= "Server Status : Off ( Testing )"
22 |
23 | elif( command== '/testoff'):
24 | Server.isTesting= False
25 | out= "Server Status : On ( not Testing )"
26 |
27 | elif( command== '/v'):
28 | out= "Numero Video Inviati: "+ str( Server.video_sent)+ "\nLast Reset: "+ str( Server.video_sent_resetDate)
29 |
30 | elif( command== '/p'):
31 | out= "Numero Pics Inviate: "+ str( Server.pics_sent)+ "\nLast Reset: "+ str( Server.pics_sent_resetDate)
32 |
33 | elif( command== '/sc'):
34 | out= "Numero Sessioni avviate: "+ str( Server.session_count())+ "\nLast Reset: "+ str( Server.session_reset_time)
35 |
36 | elif( command== '/uc'):
37 | out= "Numero Utenti: "+ str( Server.user_count)+ "\nLast Reset: "+ str( Server.user_count_resetDate)
38 |
39 | elif( command== '/avr'):
40 | out= "List Ricerche:\n\n"
41 | for i in Server.all_video_research:
42 | out= out+ str( i)+ "\n"
43 | for z in Server.all_video_research[ i]:
44 | out= out+ " "+ str( z)+ '\n'
45 |
46 | elif( command== '/au'):
47 | out= "List Utenti:\n\n"
48 | for i in Server.all_users:
49 | out= out+ str( i)+ "\n"
50 |
51 | elif( command== '/wl'):
52 | out= "WhiteList:\n\n"
53 | for i in Server.whiteList:
54 | out= out+ str( i)+ "\n"
55 |
56 | elif( command== '/bl'):
57 | out= "BlackList:\n\n"
58 | for i in Server.blackList:
59 | out= out+ str( i)+ "\n"
60 |
61 | elif( command== '/rv'):
62 | Server.video_sent= 0
63 | Server.video_sent_resetDate= datetime.datetime.now()
64 | out= "Video count resetted\nActual Date: "+ str( datetime.datetime.now())
65 | elif( command== '/rp'):
66 | Server.pics_sent= 0
67 | Server.pics_sent_resetDate= datetime.datetime.now()
68 | out= "Pics count resetted\nActual Date: "+ str( datetime.datetime.now())
69 | elif( command== '/ras'):
70 | Server.sessions= {}
71 | Server.session_reset_time= datetime.datetime.now()
72 | out= "All Sessions resetted\nActual Date: "+ str( datetime.datetime.now())
73 | elif( command== '/ravr'):
74 | Server.all_video_research= {}
75 | Server.all_video_research_resetDate= datetime.datetime.now()
76 | out= "All Video Research List resetted\nActual Date: "+ str( datetime.datetime.now())
77 | elif( command== '/rau'):
78 | Server.all_users= []
79 | Server.all_users_resetDate= datetime.datetime.now()
80 | out= "All User List resetted\nActual Date: "+ str( datetime.datetime.now())
81 | elif( command== '/ruc'):
82 | Server.user_count= 0
83 | Server.user_count_resetDate= datetime.datetime.now()
84 | out= "User Count resetted\nActual Date: "+ str( datetime.datetime.now())
85 | elif( command== '/rall'):
86 | Server.video_sent= 0
87 | Server.pics_sent= 0
88 | Server.all_video_research= {}
89 | Server.all_users= []
90 | Server.video_sent_resetDate= datetime.datetime.now()
91 | Server.pics_sent_resetDate= datetime.datetime.now()
92 | Server.all_video_research_resetDate= datetime.datetime.now()
93 | Server.all_users_resetDate= datetime.datetime.now()
94 |
95 | out= "Every Statistic resetted\nActual Date: "+ str( datetime.datetime.now())
96 |
97 | elif( command.split(' ', 1)[0]== '/addwl'):
98 | user_input= ( update.message.text).split(' ', 1)[1]
99 | Server.add_to_whiteList( user_input)
100 |
101 | out= user_input+ " aggiunto alla WhiteList"
102 |
103 | elif( command.split(' ', 1)[0]== '/addbl'):
104 | user_input= ( update.message.text).split(' ', 1)[1]
105 | Server.add_to_blackList( user_input)
106 |
107 | out= user_input+ " aggiunto alla BlackList"
108 |
109 | elif( command.split(' ', 1)[0]== '/rmwl'):
110 | user_input= ( update.message.text).split(' ', 1)[1]
111 | Server.remove_from_whiteList( user_input)
112 |
113 | out= user_input+ " rimosso dalla WhiteList"
114 |
115 | elif( command.split(' ', 1)[0]== '/rmbl'):
116 | user_input= ( update.message.text).split(' ', 1)[1]
117 | Server.remove_from_blackList( user_input)
118 |
119 | out= user_input+ " rimosso dalla BlackList"
120 |
121 |
122 |
123 | else:
124 | out= "Comando Errato Bro"
125 |
126 |
127 | context.bot.send_message(chat_id=update.effective_chat.id, text= out)
128 |
129 | updater = Updater(token='*****', use_context=True)
130 | dispatcher = updater.dispatcher
131 |
132 |
133 | controller_updater = Updater(token='*****', use_context=True)
134 | controller_dispatcher = controller_updater.dispatcher
135 |
136 |
137 | controller_dispatcher.add_handler( CommandHandler('v', controller_command), 1)
138 | controller_dispatcher.add_handler( CommandHandler('p', controller_command), 1)
139 | controller_dispatcher.add_handler( CommandHandler('avr', controller_command), 1)
140 | controller_dispatcher.add_handler( CommandHandler('uc', controller_command), 1)
141 | controller_dispatcher.add_handler( CommandHandler('sc', controller_command), 1)
142 | controller_dispatcher.add_handler( CommandHandler('au', controller_command), 1)
143 | controller_dispatcher.add_handler( CommandHandler('rv', controller_command), 1)
144 | controller_dispatcher.add_handler( CommandHandler('rp', controller_command), 1)
145 | controller_dispatcher.add_handler( CommandHandler('ravr', controller_command), 1)
146 | controller_dispatcher.add_handler( CommandHandler('rau', controller_command), 1)
147 | controller_dispatcher.add_handler( CommandHandler('ruc', controller_command), 1)
148 | controller_dispatcher.add_handler( CommandHandler('ras', controller_command), 1)
149 | controller_dispatcher.add_handler( CommandHandler('rall', controller_command), 1)
150 | controller_dispatcher.add_handler( CommandHandler('teston', controller_command), 1)
151 | controller_dispatcher.add_handler( CommandHandler('testoff', controller_command), 1)
152 | controller_dispatcher.add_handler( CommandHandler('addbl', controller_command), 1)
153 | controller_dispatcher.add_handler( CommandHandler('addwl', controller_command), 1)
154 | controller_dispatcher.add_handler( CommandHandler('rmbl', controller_command), 1)
155 | controller_dispatcher.add_handler( CommandHandler('rmwl', controller_command), 1)
156 | controller_dispatcher.add_handler( CommandHandler('wl', controller_command), 1)
157 | controller_dispatcher.add_handler( CommandHandler('bl', controller_command), 1)
158 |
159 |
160 |
161 | dispatcher.add_handler( CommandHandler('start', start_session), 1)
162 |
163 | #VIDEOS COMMAND HANDLERS
164 | dispatcher.add_handler( MessageHandler(Filters.text & (~Filters.command), video_actions.echo))
165 |
166 | dispatcher.add_handler( CommandHandler('update', video_actions.update))
167 | dispatcher.add_handler( CommandHandler('randomTest', video_actions.randomTest))
168 | dispatcher.add_handler( CommandHandler('vid', video_actions.vid))
169 | dispatcher.add_handler( CommandHandler('help', video_actions.help))
170 |
171 | dispatcher.add_handler( CallbackQueryHandler( video_actions.next, pattern='^' + "/nextVideo" + '$'))
172 | dispatcher.add_handler( CallbackQueryHandler( video_actions.nextCategories, pattern='^' + "/nextCategoriesVideo" + '$'))
173 | dispatcher.add_handler( CallbackQueryHandler( video_actions.showCategory, pattern='^' + "/showCategoryVideo" + '$'))
174 |
175 |
176 |
177 |
178 | #PICS COMMAND HANDLERS
179 | # dispatcher.add_handler( MessageHandler(Filters.text & (~Filters.command), pics_actions.echo), 1)
180 |
181 | # dispatcher.add_handler( CallbackQueryHandler( pics_actions.showPics, pattern='^' + "/showPics" + '$'))
182 | # dispatcher.add_handler( CallbackQueryHandler( pics_actions.nextCategories, pattern='^' + "/nextCategoriesPics" + '$'))
183 | # dispatcher.add_handler( CallbackQueryHandler( pics_actions.showCategory, pattern='^' + "/showCategoryPics" + '$'))
184 |
185 |
186 |
187 | updater.start_polling()
188 | controller_updater.start_polling()
189 |
190 |
191 |
192 |
--------------------------------------------------------------------------------
/modules/.gitkeep:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/modules/Server.py:
--------------------------------------------------------------------------------
1 | import datetime
2 |
3 | #SERVER STATUS ATTRIBUTES
4 |
5 | isTesting= False
6 |
7 | sessions= {}
8 |
9 |
10 | whiteList= [
11 | 'KarmaKunh'
12 |
13 | ]
14 |
15 | blackList= [
16 |
17 | ]
18 |
19 |
20 |
21 | #SERVER STATISTICS ATTRIBUTES
22 |
23 | pics_sent= 0
24 | video_sent= 0
25 | user_count= 0
26 | all_video_research= {}
27 | all_users= []
28 |
29 |
30 | session_reset_time= datetime.datetime.now()
31 | user_count_resetDate= datetime.datetime.now()
32 | video_sent_resetDate = datetime.datetime.now()
33 | pics_sent_resetDate = datetime.datetime.now()
34 | all_video_research_resetDate = datetime.datetime.now()
35 | all_users_resetDate = datetime.datetime.now()
36 |
37 |
38 | #SERVER STATISTICS METHODS
39 |
40 | def session_count():
41 | return len( sessions)
42 |
43 |
44 | def add_to_whiteList( username):
45 | whiteList.append( username)
46 |
47 | def remove_from_whiteList( username):
48 | try:
49 | whiteList.remove( username)
50 | except:
51 | print("error")
52 | pass
53 |
54 | def add_to_blackList( username):
55 | blackList.append( username)
56 |
57 | def remove_from_blackList( username):
58 | try:
59 | blackList.remove( username)
60 | except:
61 | print("error")
62 | pass
63 |
--------------------------------------------------------------------------------
/modules/Session.py:
--------------------------------------------------------------------------------
1 | from modules.users.Users import User, Users
2 | import modules.Server as Server
3 | from modules.Utilities import *
4 | import threading
5 | import time
6 |
7 | class Session:
8 |
9 | user= None
10 |
11 |
12 | #GENERAL ATTRIBUTES
13 |
14 | lastText= "none"
15 |
16 | #VIDEO ATTRIBUTES
17 |
18 | videos= None #videos_per_user={}
19 | wait= False #wait_for_input=[]
20 | categories= None #categories_per_user= {}
21 | end= True #session_ended={ }
22 |
23 | #PICS ATTRIBUTES
24 |
25 | pics= None
26 |
27 |
28 |
29 | #__INIT__ METHOD
30 |
31 | def __init__( self, update, context):
32 | self.start( update, context)
33 |
34 |
35 |
36 |
37 | #START METHOD
38 |
39 |
40 | def send_log_thread( self, context, text):
41 | time.sleep(2)
42 | context.bot.send_message(chat_id=-1001493914748, text= text)
43 |
44 |
45 | def start(self, update, context):
46 |
47 | users= Users()
48 |
49 | username= ""
50 | if( update.effective_message.from_user.username!= None):
51 | username= update.effective_message.from_user.username
52 | else:
53 | username= str( update.effective_chat.id)
54 |
55 |
56 | if( users.check_user_permission( Server.isTesting, username)):
57 |
58 | printText= username+" , "+str( update.effective_chat.id)+" Started the BOT"
59 | print( printText)
60 | thread= threading.Thread( target= self.send_log_thread, args=[ context, printText])
61 | thread.start()
62 |
63 | Server.all_users.append( username)
64 | Server.user_count= Server.user_count+ 1
65 |
66 | self.user= User( update.effective_chat.id, username)
67 | #Pics.per_user_nextOk[ update.effective_chat.id]= True
68 |
69 | context.bot.send_message(chat_id=update.effective_chat.id, text="BOT AGGIORANTO ALLA VERSIONE 2.1.4\n\nNovita':\nCorretto un bug che impediva di usare la funzione Search Video Correttamente\n\n\n", reply_markup= markup_default)
70 |
71 | context.bot.send_message(chat_id=update.effective_chat.id, text="Hi "+username+"!\nWellcome to FavePorn!\n\nHere you can find and download all the porn videos u desire from the site PornHub\n\nTo prevent PornHub from blocking our bot, Every link last for 1 hour, but don't panic ;) All you have to do is answer the expired video with the command /update, and that's it, the link is back to work\n\nYOUR FAP IS OUR PRIORITY\n\n", reply_markup= markup_default)
72 | context.bot.send_message(chat_id=update.effective_chat.id, text="Hi "+username+"!\nBenvenuto in FavePorn!\n\nQui hai la possibilita di cercare e scaricare tutti i porno che desideri dal sito PornHub\n\nPer evitare che PornHub blocchi il bot, tutti i link hanno la durata di 1 ora, ma non preoccuparti ;) Basta inviare al bot, come risposta al video scaduto, il comando /update ed il gioco e' fatto\n\nLE VOSTRE SEGHE SONO LA NOSTRA PRIORITA'\n\n", reply_markup= markup_default)
73 |
74 |
75 |
76 |
77 | else:
78 | if( Server.isTesting):
79 | printText= username+" , "+ str( update.effective_chat.id)+" not in WhiteList"
80 | print( printText)
81 | thread= threading.Thread( target= Video.send_log_thread, args=[ context, printText])
82 | thread.start()
83 |
84 | context.bot.send_message(chat_id=update.effective_chat.id, text="Bot in Manutenzione! Torna piu' tardi ;)")
85 | context.bot.send_message(chat_id=update.effective_chat.id, text= "Bot under maintenance! Come back later ;)")
86 | else:
87 | printText= username+" , "+ str( update.effective_chat.id)+" user in BlackList"
88 | print( printText)
89 | thread= threading.Thread( target= Video.send_log_thread, args=[ context, printText])
90 | thread.start()
91 |
92 | context.bot.send_message(chat_id=update.effective_chat.id, text="Sei sulla BlackList bro! Fottiti, tu non entri [ Sei Stato Bannato ]")
93 | context.bot.send_message(chat_id=update.effective_chat.id, text= "U are on BlackList bro! Fuck u motherfucker [ You have been banned ]")
94 |
95 |
96 | #USER METHODS
97 |
98 | def get_username( self):
99 | return self.user.username
100 |
101 |
102 | #VIDEO METHODS
103 |
104 | def set_videos( self, videos):
105 | self.videos= videos
106 |
107 | def set_categories( self, categories):
108 | self.categories= categories
109 |
110 | def get_videos( self):
111 | return self.videos
112 |
113 | def get_categories( self):
114 | return self.categories
115 |
116 | #PICS METHODS
117 |
118 | def set_pics( self, pics):
119 | self.pics= pics
120 |
121 | def get_pics( self):
122 | return self.pics
--------------------------------------------------------------------------------
/modules/Utilities.py:
--------------------------------------------------------------------------------
1 |
2 | from telegram import ReplyKeyboardMarkup, KeyboardButton
3 | from telegram import InlineKeyboardMarkup, InlineKeyboardButton, ReplyKeyboardRemove
4 |
5 |
6 | #GENERAL UTILITIES
7 |
8 | command_list_ita=[
9 | 'Sta tutto nei bottoni in basso\nSe non li vedi, premi il bottoncino accanto alla tastiera che raffigura 4 quadratini.\n Cosi\' il menu\' apparira\'\n\n\n'
10 | 'COMANDO SPECIALE\n\n/update - Rispondi ad un video inviato con questo comando per rinnovarne il link\n\n',
11 | 'I Link dei video scadono dopo un ora, ma una volta scaduti, se riponderai al video invando il comando /update, il link ritornera\' a funzionare\n\n'
12 |
13 |
14 | ]
15 |
16 | command_list_eng=[
17 | 'Everything is on the buttons\nIf you can\'t see them, click the small button at the right of the keyboard showing 4 little squares\n So, the menu\' will appear\n\n\n'
18 | 'SPECIAL COMMAND\n\n/update - Answer to video sent by the bot with this command to renew the link\n\n',
19 | 'Video links last for 1 hour, but once expired, if you answer the video with the command /update, the link will work again\n\n'
20 |
21 |
22 | ]
23 |
24 | #VIDEO UTILITIES
25 |
26 | markup_default= ReplyKeyboardMarkup([
27 | [ KeyboardButton( text="Porn Video Categories")],
28 | # [ KeyboardButton( text="Categorie Hot Pics")],
29 | [ KeyboardButton( text="Search Video")],
30 | [ KeyboardButton( text="Search by Link")],
31 | [ KeyboardButton( text="Help")]
32 |
33 | ])
34 |
35 | markup_video_menu= ReplyKeyboardMarkup([
36 | [ KeyboardButton( text="Main Menu")]
37 |
38 | ])
39 |
40 |
41 | #PICS UTILITIES
42 |
43 | markup_pics_menu= ReplyKeyboardMarkup([
44 | [ KeyboardButton( text="Next Pic")],
45 | [ KeyboardButton( text="Menu Principale")]
46 |
47 | ])
48 |
49 | markup_null= InlineKeyboardMarkup([
50 |
51 |
52 | ])
53 |
54 | markup_null_Keyboard= ReplyKeyboardRemove([
55 |
56 | ])
--------------------------------------------------------------------------------
/modules/users/.gitkeep:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/modules/users/Users.py:
--------------------------------------------------------------------------------
1 | from modules.Server import blackList, whiteList
2 |
3 | class Users:
4 |
5 |
6 | def checkWhiteList( self, username):
7 | out= False
8 | for i in whiteList:
9 | if( i== username):
10 | out= True
11 |
12 | return out
13 |
14 | def checkBlackList( self, username):
15 | out= True
16 | for i in blackList:
17 | if( i== username):
18 | out= False
19 |
20 | return out
21 |
22 | def check_user_permission( self, isTesting, username):
23 | out= False
24 | if( isTesting):
25 | out= self.checkWhiteList( username)
26 | else:
27 | out= self.checkBlackList( username)
28 |
29 | return out
30 |
31 |
32 | class User:
33 |
34 | chat_id= 0
35 | username= ""
36 |
37 | def __init__( self, chat_id, username):
38 | self.chat_id= chat_id
39 | self.username= username
40 |
41 |
42 |
--------------------------------------------------------------------------------
/modules/video/.gitkeep:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/modules/video/VideoClasses.py:
--------------------------------------------------------------------------------
1 | from modules.video.pageScrape.searchPage import getPage, getVideo, getVideoThumb
2 | from telegram import InlineKeyboardMarkup, InlineKeyboardButton, InputMediaVideo
3 | import threading
4 | import time
5 | import re
6 | import os
7 |
8 | def updateLink( update, context):
9 | message_id= update.message.reply_to_message.message_id
10 | print( message_id)
11 | pageKey= ""
12 |
13 | f = open( "users_files/"+ str( update.effective_chat.id)+".txt", "r")
14 | for line in f:
15 | lineSplit= line.split( " ")
16 | if( lineSplit[ 0]== str( message_id)):
17 | pageKey= lineSplit[ 1]
18 |
19 | pageKey= pageKey.split( "\n")[0]
20 | pageKey= pageKey.replace( ' ', '')
21 |
22 | newLink= getVideo( pageKey)
23 |
24 | markup= InlineKeyboardMarkup([
25 | [ InlineKeyboardButton( text="Porn Link", url= newLink)]
26 | #[ InlineKeyboardButton( text="Next Video", callback_data= "/next")]
27 |
28 | ])
29 |
30 | context.bot.edit_message_reply_markup( chat_id= update.effective_chat.id, message_id= message_id, reply_markup= markup)
31 | context.bot.send_message(chat_id=update.effective_chat.id, text="Video Link Updated")
32 |
33 | # thread= threading.Thread( target=updateLink_thread, args=[ update, context, pageKey, message_id])
34 | # thread.start()
35 |
36 |
37 |
38 |
39 |
40 | def updateLink_thread( update, context, pageKey, message_id):
41 |
42 | newLink= ""
43 |
44 | out= False
45 |
46 | while( not out):
47 | try:
48 | newLink= getVideo( pageKey)
49 | out= True
50 |
51 | except:
52 | out= False
53 | time.sleep( 0.3)
54 |
55 | markup= InlineKeyboardMarkup([
56 | [ InlineKeyboardButton( text="Porn Link", url= newLink)],
57 | [ InlineKeyboardButton( text="Next Video", callback_data= "/nextVideo")]
58 |
59 | ])
60 |
61 | context.bot.edit_message_reply_markup( chat_id= update.effective_chat.id, message_id= message_id, reply_markup= markup)
62 | context.bot.send_message(chat_id=update.effective_chat.id, text="Video Link Updated")
63 |
64 |
65 | class Videos:
66 |
67 | videosPages= ['None']
68 | videosPrevs= ['None']
69 | videosTitles= ['None']
70 | videosThumbs= ['None']
71 |
72 | user_input= ""
73 | page_count= 1
74 |
75 | videoCount= -1 #videoSelected
76 |
77 | def __init__(self, user_input, typeOf):
78 | self.user_input= user_input
79 | res= getPage( user_input, typeOf)
80 |
81 | if( typeOf== "user_input"):
82 | self.videosPages= res['pages_array']
83 | self.videosPrevs= res['videoprev_array']
84 | self.videosTitles= res['titles']
85 | self.videosThumbs= res['thumbs']
86 | self.videoCount= -1
87 | elif( typeOf== "link"):
88 | self.videosPages= res['pages_array']
89 | self.videosTitles= res['titles']
90 | self.videosThumbs= res['thumbs']
91 | self.videoCount= -1
92 |
93 |
94 |
95 | def nextVideo(self, update, context, typeOf):
96 | if( ( self.videoCount+ 1)< len( self.videosPages)):
97 | context.bot.send_chat_action(chat_id=update.effective_chat.id, action= "upload_video")
98 |
99 | self.videoCount= self.videoCount+ 1
100 | nextVideo= Video( self.videosPages[ self.videoCount], self.videosPrevs[ self.videoCount], self.videosTitles[ self.videoCount], self.videosThumbs[ self.videoCount])
101 | nextVideo.sendVideo( update, context, typeOf)
102 |
103 | return nextVideo
104 |
105 | else:
106 | self.page_count= self.page_count+ 1
107 | res= getPage( self.user_input+ "&page="+ str( self.page_count), "user_input")
108 |
109 | self.videosPages= res['pages_array']
110 | self.videosPrevs= res['videoprev_array']
111 | self.videosTitles= res['titles']
112 | self.videosThumbs= res['thumbs']
113 | self.videoCount= -1
114 |
115 |
116 |
117 | class Video:
118 |
119 | video_title= ""
120 | video_thumb= ""
121 | video_prev= ""
122 | video_page= ""
123 | video_link= ""
124 |
125 | def __init__(self, video_page, video_prev, video_title, video_thumb):
126 |
127 | self.video_page= video_page
128 | self.video_prev= video_prev
129 | self.video_title= video_title
130 | self.video_thumb= video_thumb
131 | self.video_link= getVideo( video_page)
132 | print( self.video_thumb)
133 |
134 | def sendVideo( self, update, context, typeOf):
135 |
136 | markup= None
137 |
138 | if( typeOf== "user_input"):
139 | markup= InlineKeyboardMarkup([
140 | [ InlineKeyboardButton( text="Porn Link", url= self.video_link)],
141 | [ InlineKeyboardButton( text="Next Video", callback_data= "/nextVideo")]
142 |
143 | ])
144 |
145 | #thumb= getVideoThumb( update.effective_chat.id, self.video_thumb)
146 |
147 |
148 | self.video_thumb= re.findall(r'(.*)\" onclick', self.video_thumb)[0]
149 |
150 | print( self.video_thumb)
151 |
152 | temp= context.bot.send_photo(chat_id=update.effective_chat.id, photo= self.video_thumb, caption= self.video_title, reply_markup= markup)
153 |
154 | #os.remove( thumb)
155 |
156 | thread= threading.Thread( target=self.videoThread, args=[ temp, markup, update, context])
157 | thread.start()
158 |
159 | elif( typeOf== "link"):
160 | markup= InlineKeyboardMarkup([
161 | [ InlineKeyboardButton( text="Porn Link", url= self.video_link)]
162 |
163 | ])
164 |
165 | temp= context.bot.send_photo(chat_id=update.effective_chat.id, photo= self.video_thumb, caption= self.video_title, reply_markup= markup)
166 |
167 |
168 |
169 | f = open( "users_files/"+ str( update.effective_chat.id)+".txt", "a")
170 | f.write( str( temp.message_id)+ " "+ self.video_page+"\n")
171 | f.close()
172 |
173 |
174 | def videoThread( self, temp, markup, update, context):
175 |
176 | print( self.video_prev)
177 | try:
178 | context.bot.edit_message_media( chat_id=update.effective_chat.id, message_id= temp.message_id, media=InputMediaVideo( media= self.video_prev, caption= self.video_title), reply_markup= markup)
179 | except:
180 | print( "EEEEEEEEEEERRRRRRRRRROOOOOOOOOOORRRRRRRRREEEEEEE")
181 | pass
182 |
--------------------------------------------------------------------------------
/modules/video/categories/.gitkeep:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/modules/video/categories/Video_categoriesClasses.py:
--------------------------------------------------------------------------------
1 | from modules.video.pageScrape.searchPage import getCategories, getCategoryPic
2 | from telegram import InlineKeyboardMarkup, InlineKeyboardButton, InputMediaVideo
3 | import threading
4 | import time
5 | import re
6 |
7 | class Categories:
8 |
9 | cats_titles= []
10 | #cats_thumbs= []
11 | cats_links= []
12 |
13 | cat_count= -1
14 |
15 | def __init__( self):
16 | cats= getCategories()
17 |
18 | self.cats_titles= cats['titles']
19 | #self.cats_thumbs= cats['thumbs']
20 | #self.cats_links= cats['links']
21 |
22 |
23 | def nextCategory(self, update, context):
24 | isNext= False
25 | out= "ok"
26 |
27 | for i in range(3):
28 | if( ( self.cat_count+ 1)< len( self.cats_titles)):
29 |
30 | if( i!= 2 and ( ( self.cat_count+ 1)< len( self.cats_titles)- 1)):
31 | isNext= False
32 | else:
33 | isNext= True
34 |
35 | self.cat_count= self.cat_count+ 1
36 | #nextCategory= Category( self.cats_titles[ self.cat_count], self.cats_thumbs[ self.cat_count], self.cats_links[ self.cat_count], isNext)
37 | thumb= getCategoryPic( self.cats_titles[ self.cat_count])
38 | nextCategory= Category( self.cats_titles[ self.cat_count], thumb, isNext)
39 | nextCategory.sendCategory( update, context)
40 |
41 | else:
42 | out= "END"
43 |
44 | return out
45 |
46 | def getSelectedCategory( self, update, context):
47 | title= update.callback_query.message.reply_markup.inline_keyboard[0][0].text
48 | out= ""
49 |
50 | if( title!= None):
51 | count= 0
52 | for i in self.cats_titles:
53 | if( i== title):
54 | out= i.replace( " ", "+")
55 |
56 | count= count+ 1
57 |
58 | return out
59 |
60 |
61 |
62 | class Category:
63 |
64 | cat_title= ""
65 | cat_thumb= ""
66 | #cat_link= ""
67 |
68 | isNext= False
69 |
70 | def __init__(self, cat_title, cat_thumb, isNext):
71 |
72 | self.cat_title= cat_title
73 | self.cat_thumb= cat_thumb
74 | #self.cat_link= cat_link
75 | self.isNext= isNext
76 |
77 | def sendCategory( self, update, context):
78 |
79 | thumb= re.findall(r'(.*)" onclick=', self.cat_thumb)[0]
80 |
81 | if( not self.isNext):
82 | markup= InlineKeyboardMarkup([
83 | [ InlineKeyboardButton( text=self.cat_title, callback_data= "/showCategoryVideo")]
84 |
85 | ])
86 |
87 | print("Thumb fin:"+thumb)
88 |
89 | temp= context.bot.send_photo(chat_id=update.effective_chat.id, photo=thumb, reply_markup= markup)
90 |
91 | else:
92 | markup= InlineKeyboardMarkup([
93 | [ InlineKeyboardButton( text=self.cat_title, callback_data= "/showCategoryVideo")],
94 | [ InlineKeyboardButton( text="Next Categories", callback_data= "/nextCategoriesVideo")]
95 |
96 | ])
97 |
98 | temp= context.bot.send_photo(chat_id=update.effective_chat.id, photo=thumb, reply_markup= markup)
99 |
--------------------------------------------------------------------------------
/modules/video/pageScrape/.gitkeep:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/modules/video/pageScrape/searchPage.py:
--------------------------------------------------------------------------------
1 |
2 | import requests
3 | import re
4 | from random import randint
5 | import tempfile
6 | import modules.Server as Server
7 | import urllib.request
8 |
9 |
10 | def getPage( input, typeOf):
11 |
12 | if( typeOf== "user_input"):
13 | url= "https://it.pornhub.com/video/search?search="+ input
14 |
15 |
16 | page= get_url( url)
17 |
18 | result= []
19 | titles= []
20 | pages_array= []
21 | videoprev_array= []
22 |
23 | result= re.findall(r'href="(.*)"\s{17}data-webm="(.*)" data-poster=', page)
24 | titles= re.findall(r'alt="(.*)"\n\t{7}data-path="', page)
25 | thumbs= re.findall(r'data-poster="(.*)" >', page)
26 |
27 | for i in result:
28 | pages_array.append( i[0])
29 |
30 | for i in result:
31 | videoprev_array.append( i[1])
32 |
33 | res= { 'pages_array': pages_array, 'videoprev_array': videoprev_array, 'titles': titles, 'thumbs': thumbs}
34 |
35 |
36 | elif( typeOf== "link"):
37 | url= input
38 | page= get_url( url)
39 |
40 | title= []
41 | thumb= []
42 |
43 | title= re.findall(r'', page)
44 | thumb= re.findall(r'', page)
45 |
46 |
47 |
48 | res= { 'pages_array': [ url], 'titles': title, 'thumbs': thumb}
49 |
50 |
51 | return res
52 |
53 |
54 |
55 |
56 |
57 | def getVideo( url):
58 | print("url: "+url)
59 |
60 | #video gnocca: 'https://it.pornhub.com/view_video.php?viewkey=ph5e40ef7fb74aa'
61 |
62 | checkLink = url[0:4]
63 |
64 | print( "checkLink: "+ checkLink)
65 |
66 | result= []
67 |
68 |
69 | page= '[]'
70 |
71 | #print( 'https://it.pornhub.com/video/get_media?s=eyJrIjoi'+result[0]+'=0')
72 | #if( checkLink== "http"):
73 |
74 | # page= get_url( url)
75 | # result= re.findall(r'qualityItems(.*)\n', page)
76 | # #page= get_url('https://it.pornhub.com/video/get_media?s=eyJrIjoi'+result[0])
77 | #else:
78 |
79 | # page= get_url( "https://it.pornhub.com"+ url)
80 | # result= re.findall(r'qualityItems(.*)\n', page)
81 | # #page= get_url('https://it.pornhub.com/video/get_media?s=eyJrIjoi'+result[0])
82 |
83 | if( checkLink== "http"):
84 | page= get_url( url)
85 | result= re.findall(r'"videoUrl":"https:.*get_media\?s=eyJrIjoi(.*)=p","quality"', page)
86 | page= get_url('https://it.pornhub.com/video/get_media?s=eyJrIjoi'+result[0]+'=p')
87 | else:
88 | page= get_url( "https://it.pornhub.com"+ url)
89 | result= re.findall(r'"videoUrl":"https:.*get_media\?s=eyJrIjoi(.*)=p","quality"', page)
90 | page= get_url('https://it.pornhub.com/video/get_media?s=eyJrIjoi'+result[0]+'=p')
91 |
92 |
93 | print( "Donwloading page")
94 | f = open( "modules/video/pageScrape/page_check.txt", "w", encoding="utf-8")
95 | f.write( page)
96 |
97 | f.close()
98 |
99 |
100 | video_link= []
101 | video_link_def= ""
102 |
103 | print(result);
104 |
105 | if( page!= "[]"):
106 | #print("\n"+result[ 1])
107 |
108 | video_link= re.findall(r'"quality":"720"},.*"videoUrl":"(.*)","quality":"1080"}', page) #cercare video link 1080p
109 |
110 | if( len( video_link)== 0 or video_link[ 0]== ""):
111 | video_link= re.findall(r'"quality":"480"},.*"videoUrl":"(.*)","quality":"720"}', page) #cercare video link 720p
112 |
113 | if( len( video_link)== 0 or video_link[ 0]== ""):
114 | video_link= re.findall(r'"quality":"240"},.*"videoUrl":"(.*)","quality":"480"}', page) #cercare video link 480p
115 |
116 | if( len( video_link)== 0 or video_link[ 0]== ""):
117 | video_link= re.findall(r'.*"videoUrl":"(.*)","quality":"240"}', page) #cercare video link 240p
118 | else:
119 | print("Page Link Vuota")
120 |
121 |
122 |
123 | if( len( video_link)==0):
124 | #video non trovato
125 | video_link_def= "Video Non Trovato"
126 |
127 | else:
128 | video_link_def= video_link[0].replace( '\\', '') #Rimove caratteri inutili dal link
129 |
130 |
131 |
132 | #print( video_link_def)
133 |
134 | return video_link_def
135 |
136 |
137 | def getVideoThumb( chat_id, url):
138 | page= get_pics_url( url)
139 | #print( page)
140 | print( url)
141 |
142 | url= url.replace( "/", "")
143 | url= url.replace( "https:", "")
144 | url= url.replace( ".", "")
145 |
146 | path= "users_files/"+str( chat_id)+"_"+url
147 | f = open( path, "wb")
148 | f.write( page)
149 |
150 | f.close()
151 |
152 | return path
153 |
154 |
155 | def getCategories():
156 |
157 | r = get_url_desktop( "https://it.pornhub.com/categories")
158 |
159 | titles= []
160 | links= []
161 |
162 | categories= re.findall(r'', r)
163 | print(categories)
164 | #thumbs= re.findall(r'src=".*"\n\t{8}data-thumb_url="(.*)"', r)
165 |
166 | # for i in categories:
167 | # links.append( i[0])
168 |
169 | # for i in categories:
170 | # titles.append( i[1])
171 |
172 | #res= { 'titles' : titles, 'thumbs' : thumbs, 'links' : links}
173 | try:
174 | categories.remove("Gay")
175 | except:
176 | pass
177 | try:
178 | categories.remove("Maschi Bisessuali")
179 | except:
180 | pass
181 | try:
182 | categories.remove("Autoerotismo Maschile")
183 | except:
184 | pass
185 | try:
186 | categories.remove("Uomini Muscolosi")
187 | except:
188 | pass
189 |
190 | res= { 'titles' : categories }
191 |
192 | print(res['titles'])
193 |
194 | return res
195 |
196 |
197 | def getCategoryPic( name):
198 | name= name.replace( " ", "+")
199 | url= "https://it.pornhub.com/video/search?search="+ name
200 |
201 | page= get_url( url)
202 |
203 | thumbs= re.findall(r'data-poster="(.*)" >', page)
204 |
205 | return thumbs[ randint(0, 6)]
206 |
207 |
208 | def get_the_f_url( url):
209 |
210 | headers= {
211 | 'Accept' : 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
212 | 'accept-encoding' : 'gzip, deflate, br',
213 | 'accept-language' : 'it-IT,it;q=0.9',
214 | 'connection' : 'keep-alive',
215 | 'cookie' : 'ua=d99eeb685e21a4d0dbed1f405355fc60; platform=mobile; bs=56upk9stfqjyqo1nxc9jw53ogphawp0k; ss=151136400168700510; fg_fcf2e67d6468e8e1072596aead761f2b=13853.100000; atatusScript=hide; cookiesBannerSeen=1; _ga=GA1.2.1221798682.1657166705; _gid=GA1.2.349403146.1657166705; local_storage=1; d_fs=1; d_uidb=41f144cd-c979-a031-0af0-63f62074721c; d_uid=41f144cd-c979-a031-0af0-63f62074721c; entryOrigin=VidPg-premVid; etavt={"ph629bc32f0637b":"1_14_NA_NA|0"}; views=6; tj_UUID=90694b151dfd4db4887884a073630dfa; tj_UUID_v2=90694b15-1dfd-4db4-8878-84a073630dfa',
216 | 'host' : 'it.pornhub.com',
217 | 'sec-ch-ua' : '" Not A;Brand";v="99", "Chromium";v="100", "Google Chrome";v="100"',
218 | 'sec-ch-ua-mobile' : '?1',
219 | 'sec-ch-ua-platform' : '"Android"',
220 | 'sec-fetch-dest': 'document',
221 | 'sec-fetch-mode' : 'navigate',
222 | 'sec-fetch-site' : 'none',
223 | 'sec-fetch-user' : '?1',
224 | 'upgrade-insecure-requests' : '1',
225 | 'user-agent' : 'Mozilla/5.0 (Linux; Android 9; LLD-L31) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.79 Mobile Safari/537.36'
226 | }
227 | r = requests.get(url, headers=headers)
228 | #print( "result="+r.text)
229 | return r.text
230 |
231 |
232 |
233 |
234 |
235 |
236 | def get_url_desktop( url):
237 |
238 | headers= {
239 | 'Accept' : '*/*',
240 | 'accept-language' : 'it-IT,it;q=0.9,en-IT;q=0.8,en;q=0.7,en-US;q=0.6',
241 | 'cache-control' : 'max-age=0',
242 | 'connection' : 'keep-alive',
243 | 'cookie' : 'ua=915ae7563fe10e1c33345a2bce511386; platform_cookie_reset=mobile; platform=mobile; bs=wxjmgzglt7b9tol36qa9upnv6b2qe35g; ss=813363832411742815; fg_9d12f2b2865de2f8c67706feaa332230=54876.100000; atatusScript=hide; _ga=GA1.2.404420222.1614187370; _gid=GA1.2.25666935.1614187370; d_uidb=dd444781-83c9-4b21-9367-3382fd9ccebe; d_uid=dd444781-83c9-4b21-9367-3382fd9ccebe; local_storage=1; views=6',
244 | 'host' : 'it.pornhub.com',
245 | 'if-modified-since' : 'Wed, 24 Feb 2021 16:26:08 GMT',
246 | 'if-none-match' : '"60367e20-2ab"',
247 | 'sec-fetch-mode' : 'same-origin',
248 | 'sec-fetch-site' : 'same-origin',
249 | 'service-worker' : 'script',
250 | 'user-agent' : 'Mozilla/5.0 (Linux; Android 9; LLD-L31) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.116 Mobile Safari/537.36'
251 |
252 | }
253 | r = requests.get(url)
254 | print( "result="+r.text)
255 | return r.text
256 |
257 |
258 | def get_pics_url( url):
259 | session = requests.session()
260 | session.proxies = {}
261 | headers= {
262 | 'Accept' : '*/*',
263 | 'accept-language' : 'it-IT,it;q=0.9,en-IT;q=0.8,en;q=0.7,en-US;q=0.6',
264 | 'cache-control' : 'max-age=0',
265 | 'connection' : 'keep-alive',
266 | 'cookie' : 'ua=915ae7563fe10e1c33345a2bce511386; platform_cookie_reset=mobile; platform=mobile; bs=wxjmgzglt7b9tol36qa9upnv6b2qe35g; ss=813363832411742815; fg_9d12f2b2865de2f8c67706feaa332230=54876.100000; atatusScript=hide; _ga=GA1.2.404420222.1614187370; _gid=GA1.2.25666935.1614187370; d_uidb=dd444781-83c9-4b21-9367-3382fd9ccebe; d_uid=dd444781-83c9-4b21-9367-3382fd9ccebe; local_storage=1; views=6',
267 | 'host' : 'it.pornhub.com',
268 | 'if-modified-since' : 'Wed, 24 Feb 2021 16:26:08 GMT',
269 | 'if-none-match' : '"60367e20-2ab"',
270 | 'sec-fetch-mode' : 'same-origin',
271 | 'sec-fetch-site' : 'same-origin',
272 | 'service-worker' : 'script',
273 | 'user-agent' : 'Mozilla/5.0 (Linux; Android 9; LLD-L31) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.116 Mobile Safari/537.36'
274 |
275 | }
276 | r = requests.get(url, headers=headers)
277 | print( "result="+r.text)
278 | return r.text
279 |
280 |
281 |
282 |
283 | def get_url( url):
284 |
285 | # timeout= 5
286 |
287 | headers= {
288 | 'Accept' : 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
289 | 'accept-language' : 'it-IT,it;q=0.9',
290 | 'connection' : 'keep-alive',
291 | 'cookie' : 'ua=a6eab1091b006a0183e6075e8409d85e; platform=mobile; bs=b84mr41zeskl8hponehunmw5xgf0v1gd; ss=777887794902658992; fg_fcf2e67d6468e8e1072596aead761f2b=68583.100000; atatusScript=hide; cookiesBannerSeen=1; _ga=GA1.2.49094081.1657168124; _gid=GA1.2.101549980.1657168124; d_fs=1; d_uidb=c84c56c3-2ef3-a01d-0a57-e6659fbd4f7f; d_uid=c84c56c3-2ef3-a01d-0a57-e6659fbd4f7f; local_storage=1; entryOrigin=VidPg-premVid; etavt={"ph6298e7193f932":"1_14_NA_NA|0"}; views=6; tj_UUID=37da72a238674cb6bddd910b8a11b5b8; tj_UUID_v2=37da72a2-3867-4cb6-bddd-910b8a11b5b8',
292 | 'host' : 'it.pornhub.com',
293 | 'if-modified-since' : 'Wed, 24 Feb 2021 16:26:08 GMT',
294 | 'if-none-match' : '"60367e20-2ab"',
295 | #'sec-ch-ua' : ' Not;A Brand";v="99", "Google Chrome";v="97", "Chromium";v="97',
296 | 'sec-ch-ua-mobile' : '?1',
297 | 'sec-ch-ua-platform' : 'Android',
298 | 'sec-fetch-dest' : 'document',
299 | 'sec-fetch-mode' : 'navigate',
300 | 'sec-fetch-site' : 'none',
301 | 'sec-fetch-user' : '?1',
302 | 'upgrade-insecure-requests' : '1',
303 | 'user-agent' : 'Mozilla/5.0 (Linux; Android 9; LLD-L31) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.98 Mobile Safari/537.36'
304 |
305 | }
306 |
307 |
308 | # req = urllib.request.Request( url)
309 |
310 | # req.add_header( 'Accept', '*/*')
311 | # req.add_header( 'accept-language' , 'it-IT,it;q=0.9,en-IT;q=0.8,en;q=0.7,en-US;q=0.6')
312 | # req.add_header( 'cache-control' , 'max-age=0')
313 | # req.add_header( 'connection' , 'keep-alive')
314 | # req.add_header( 'cookie' , 'ua=915ae7563fe10e1c33345a2bce511386; platform_cookie_reset=mobile; platform=mobile; bs=wxjmgzglt7b9tol36qa9upnv6b2qe35g; ss=813363832411742815; fg_9d12f2b2865de2f8c67706feaa332230=54876.100000; atatusScript=hide; _ga=GA1.2.404420222.1614187370; _gid=GA1.2.25666935.1614187370; d_uidb=dd444781-83c9-4b21-9367-3382fd9ccebe; d_uid=dd444781-83c9-4b21-9367-3382fd9ccebe; local_storage=1; views=6')
315 | # req.add_header( 'host' , 'it.pornhub.com')
316 | # req.add_header( 'if-modified-since' , 'Wed, 24 Feb 2021 16:26:08 GMT')
317 | # req.add_header( 'if-none-match' , '"60367e20-2ab"')
318 | # req.add_header( 'sec-fetch-mode' , 'same-origin')
319 | # req.add_header( 'sec-fetch-site' , 'same-origin')
320 | # req.add_header( 'service-worker' , 'script')
321 | # req.add_header( 'user-agent' , 'Mozilla/5.0 (Linux; Android 9; LLD-L31) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.116 Mobile Safari/537.36')
322 |
323 | # resp = urllib.request.urlopen(req)
324 | # content = resp.read().decode('utf-8')
325 |
326 | #print( content)
327 | r = requests.get(url, headers=headers)
328 |
329 | print( "result="+r.text)
330 |
331 | return r.text
332 |
333 | #return content
334 |
335 |
336 |
--------------------------------------------------------------------------------
/modules/video/video_actions.py:
--------------------------------------------------------------------------------
1 |
2 | import modules.Server as Server
3 | from modules.users.Users import Users
4 | from modules.Utilities import *
5 |
6 | from modules.video.VideoClasses import *
7 | from modules.video.categories.Video_categoriesClasses import *
8 | from modules.video.pageScrape.searchPage import getCategories
9 |
10 | import threading
11 | import time
12 |
13 |
14 | def echo( update, context):
15 | if update.effective_chat.id in Server.sessions:
16 | thread= threading.Thread( target= echo_thread, args=[ update, context])
17 | thread.start()
18 | else:
19 | context.bot.send_message(chat_id=update.effective_chat.id, text= "Session expired, click here to restart --> /start <--", reply_markup= markup_null)
20 |
21 |
22 | def echo_thread(update, context):
23 |
24 | if ( Server.sessions[ update.effective_chat.id].end):
25 | Server.sessions[ update.effective_chat.id].end= False
26 |
27 | username= Server.sessions[ update.effective_chat.id].get_username()
28 |
29 | text= ( update.message.text).lower()
30 |
31 | users= Users()
32 |
33 | if( not text== "next video"):
34 | printText= username+" , "+ str( update.effective_chat.id)+"| echo "+ update.message.text
35 | print( printText)
36 |
37 | thread= threading.Thread( target= send_log_thread, args=[ context, printText])
38 | thread.start()
39 |
40 | if( users.check_user_permission( Server.isTesting, username)):
41 |
42 | if( not Server.sessions[ update.effective_chat.id].wait):
43 | if( text== "porn video categories"):
44 | categories( update, context)
45 |
46 | elif( text== "next video"):
47 | context.bot.delete_message( chat_id=update.effective_chat.id, message_id= ( update.message.message_id))
48 | next( update, context)
49 |
50 | elif( text== "search video"):
51 | Server.sessions[ update.effective_chat.id].input_type= "user_input"
52 | Server.sessions[ update.effective_chat.id].wait= True
53 |
54 | context.bot.send_message(chat_id=update.effective_chat.id, text= "Inserisci dei parametri di ricerca per trovare i porno che preferisci\nEsempio: Inserisci la parola 'Milf' per trovare video inerenti la parola inserit\nPuoi Inserire anche nomi di Attrici o di Utenti PornHub", reply_markup= markup_video_menu)
55 | context.bot.send_message(chat_id=update.effective_chat.id, text= "👇 Scrivimi cosa stai cercando 👇", reply_markup= markup_video_menu)
56 | context.bot.send_message(chat_id=update.effective_chat.id, text= "👇 Write me what u are looking for 👇", reply_markup= markup_video_menu)
57 |
58 |
59 | elif( text== "search by link"):
60 | Server.sessions[ update.effective_chat.id].input_type= "link"
61 | Server.sessions[ update.effective_chat.id].wait= True
62 |
63 | context.bot.send_message(chat_id=update.effective_chat.id, text= "Inserisci il Link pornHub del video che stai cercando\nEsempio:\nInserisci \\https://it.pornhub.com/view_video.php?viewkey=ph5e40ef7fb74aa\\ per trovare il relativo video", reply_markup= markup_video_menu)
64 | context.bot.send_message(chat_id=update.effective_chat.id, text= "👇 Inserisci il link qui sotto 👇", reply_markup= markup_video_menu)
65 | context.bot.send_message(chat_id=update.effective_chat.id, text= "👇 Insert Link down Here 👇", reply_markup= markup_video_menu)
66 |
67 |
68 | elif( text== "main menu"):
69 | context.bot.send_message(chat_id=update.effective_chat.id, text= "😈 Choose an Option 😈", reply_markup= markup_default)
70 |
71 | elif( text== "help"):
72 | help( update, context)
73 | else:
74 | context.bot.send_message(chat_id=update.effective_chat.id, text= "Mhh, sembra che tu non abbia selezionato alcuna opzione\nSe ti trovi in difficolta con i comandi, usa /help\n\n😈 Altrimenti Scegli dal Menu 😈", reply_markup= markup_default)
75 | context.bot.send_message(chat_id=update.effective_chat.id, text= "Mhh, it seems you didn't choose any option from the menu\nIf u need help, use /help\n\n😈 Or else, choose an Option 😈", reply_markup= markup_default)
76 |
77 | else:
78 | if( not text== "main menu"):
79 | Server.sessions[ update.effective_chat.id].wait= False
80 | if( username in Server.all_video_research):
81 | Server.all_video_research[ username].append( text)
82 | else:
83 | Server.all_video_research[ username]= [ text]
84 |
85 | if( Server.sessions[ update.effective_chat.id].input_type== "user_input"):
86 | vid_not_command( update, context, text, "user_input")
87 | elif( Server.sessions[ update.effective_chat.id].input_type== "link"):
88 | context.bot.delete_message( chat_id=update.effective_chat.id, message_id= ( update.message.message_id))
89 | checkLink = text[0:4]
90 | if( checkLink!= "http"):
91 | context.bot.send_message(chat_id=update.effective_chat.id, text= "Link Non Valido\n\nDeve essere nel formato: 'https...view_video.php?viewkey=...", reply_markup= markup_default)
92 | context.bot.send_message(chat_id=update.effective_chat.id, text= "Link Not Valid\n\nIt has to be like this: 'https...view_video.php?viewkey=...", reply_markup= markup_default)
93 | else:
94 | vid_not_command( update, context, text, "link")
95 |
96 |
97 | else:
98 | Server.sessions[ update.effective_chat.id].wait= False
99 | context.bot.delete_message( chat_id=update.effective_chat.id, message_id= ( update.message.message_id- 1))
100 | context.bot.send_message(chat_id=update.effective_chat.id, text= "😈 Choose an Option 😈", reply_markup= markup_default)
101 |
102 | else:
103 | if( Server.isTesting):
104 | context.bot.send_message(chat_id=update.effective_chat.id, text= "Bot in Manutenzione! Torna piu' tardi ;)", reply_markup= markup_video_menu)
105 | context.bot.send_message(chat_id=update.effective_chat.id, text= "Bot under maintenance! Come back later ;)", reply_markup= markup_video_menu)
106 | else:
107 | context.bot.send_message(chat_id=update.effective_chat.id, text= "Sei sulla BlackList bro! Fottiti, tu non entri [ Sei Stato Bannato ]", reply_markup= markup_video_menu)
108 | context.bot.send_message(chat_id=update.effective_chat.id, text= "U are on BlackList bro! Fuck u motherfucker [ You have been banned ]", reply_markup= markup_video_menu)
109 |
110 | Server.sessions[ update.effective_chat.id].end= True
111 |
112 |
113 | def vid( update, context):
114 | if update.effective_chat.id in Server.sessions:
115 | thread= threading.Thread( target= vid_thread, args=[ update, context])
116 | thread.start()
117 | else:
118 | context.bot.send_message(chat_id=update.effective_chat.id, text= "Session expired, click here to restart --> /start <--", reply_markup= markup_null)
119 |
120 | def vid_thread(update, context):
121 |
122 | username= Server.sessions[ update.effective_chat.id].get_username()
123 |
124 | users= Users()
125 |
126 | if( users.check_user_permission( Server.isTesting, username)):
127 | user_input= ( update.message.text).split(' ', 1)
128 |
129 | if len( user_input)== 2:
130 | printText= username+" , "+ str( update.effective_chat.id)+"| /vid "+user_input[ 1]
131 | print( printText)
132 | thread= threading.Thread( target= send_log_thread, args=[ context, printText])
133 | thread.start()
134 |
135 | user_input = user_input[1].replace(" ", "+")
136 |
137 | videos= Videos( user_input, "user_input")
138 |
139 | Server.sessions[ update.effective_chat.id].set_videos( videos)
140 |
141 | nextVideo= ( Server.sessions[ update.effective_chat.id].get_videos()).nextVideo( update, context, "user_input")
142 |
143 | Server.video_sent= Server.video_sent+1
144 |
145 | if( username in Server.all_video_research):
146 | Server.all_video_research[ username].append( user_input)
147 | else:
148 | Server.all_video_research[ username]= [ user_input]
149 |
150 | time.sleep(0.5)
151 |
152 | else:
153 | context.bot.send_message(chat_id=update.effective_chat.id, text="comando incompleto, specifica cosa cercare\n\n/vid 'NOME ATTRICE oppure NOME VIDEO oppure CATEGORIA'")
154 | context.bot.send_message(chat_id=update.effective_chat.id, text="incomplete command, specify what u are looking for\n\n/vid 'PORNSTAR NAME or VIDEO NAME or CATEGORY'")
155 |
156 | else:
157 | if( Server.isTesting):
158 | context.bot.send_message(chat_id=update.effective_chat.id, text="Bot in Manutenzione! Torna piu' tardi ;)", reply_markup= markup_video_menu)
159 | context.bot.send_message(chat_id=update.effective_chat.id, text= "Bot under maintenance! Come back later ;)", reply_markup= markup_video_menu)
160 | else:
161 | context.bot.send_message(chat_id=update.effective_chat.id, text="Sei sulla BlackList bro! Fottiti, tu non entri [ Sei Stato Bannato ]", reply_markup= markup_video_menu)
162 | context.bot.send_message(chat_id=update.effective_chat.id, text= "U are on BlackList bro! Fuck u motherfucker [ You have been banned ]", reply_markup= markup_video_menu)
163 |
164 | def next( update, context):
165 |
166 | if update.effective_chat.id in Server.sessions:
167 | users= Users()
168 | username= Server.sessions[ update.effective_chat.id].get_username()
169 |
170 | if( users.check_user_permission( Server.isTesting, username)):
171 |
172 | if update.effective_chat.id in Server.sessions:
173 | thread= threading.Thread( target=nextThread, args=[ update, context])
174 | thread.start()
175 | Server.video_sent= Server.video_sent+1
176 | time.sleep(0.6)
177 | else:
178 | context.bot.send_message(chat_id=update.effective_chat.id, text= "Session expired, click here to restart --> /start <--", reply_markup= markup_null)
179 |
180 | else:
181 | if( Server.isTesting):
182 | context.bot.send_message(chat_id=update.effective_chat.id, text= "Bot in Manutenzione! Torna piu' tardi ;)", reply_markup= markup_video_menu)
183 | context.bot.send_message(chat_id=update.effective_chat.id, text= "Bot under maintenance! Come back later ;)", reply_markup= markup_video_menu)
184 | else:
185 | context.bot.send_message(chat_id=update.effective_chat.id, text= "Sei sulla BlackList bro! Fottiti, tu non entri [ Sei Stato Bannato ]", reply_markup= markup_video_menu)
186 | context.bot.send_message(chat_id=update.effective_chat.id, text= "U are on BlackList bro! Fuck u motherfucker [ You have been banned ]", reply_markup= markup_video_menu)
187 |
188 | else:
189 | context.bot.send_message(chat_id=update.effective_chat.id, text= "Session expired, click here to restart --> /start <--", reply_markup= markup_null)
190 |
191 |
192 |
193 | def nextThread( update, context):
194 |
195 | username= Server.sessions[ update.effective_chat.id].get_username()
196 |
197 |
198 | printText= username+" , "+ str( update.effective_chat.id)+"| /next"
199 | print( printText)
200 |
201 | thread= threading.Thread( target= send_log_thread, args=[ context, printText])
202 | thread.start()
203 |
204 | nextVideo= ( Server.sessions[ update.effective_chat.id].get_videos()).nextVideo( update, context, "user_input")
205 |
206 |
207 |
208 | def update( update, context):
209 | try:
210 | reply_to= update.message.reply_to_message
211 |
212 | if( reply_to.reply_markup.inline_keyboard[0][0].text!= None and reply_to.reply_markup.inline_keyboard[0][0].text=="Porn Link"):
213 | updateLink( update, context)
214 | else:
215 | context.bot.send_message(chat_id=update.effective_chat.id, text="Il comando /update serve per ricaricare link video scaduti. Invia questo comando come 'risposta' al video che devi ricaricare", reply_markup= markup_default)
216 | context.bot.send_message(chat_id=update.effective_chat.id, text="Command /update is used to reload expired video links. Send this command as a 'response' to the video u want to reload", reply_markup= markup_default)
217 | except:
218 | context.bot.send_message(chat_id=update.effective_chat.id, text="Il comando /update serve per ricaricare link video scaduti. Invia questo comando come 'risposta' al video che devi ricaricare", reply_markup= markup_default)
219 | context.bot.send_message(chat_id=update.effective_chat.id, text="Command /update is used to reload expired video links. Send this command as a 'response' to the video u want to reload", reply_markup= markup_default)
220 |
221 |
222 |
223 | def help(update, context):
224 | if update.effective_chat.id in Server.sessions:
225 | username= Server.sessions[ update.effective_chat.id].get_username()
226 |
227 | printText= username+" , "+ str( update.effective_chat.id)+"| /help"
228 | print( printText)
229 |
230 | thread= threading.Thread( target= send_log_thread, args=[ context, printText])
231 | thread.start()
232 |
233 | users= Users()
234 |
235 | if( users.check_user_permission( Server.isTesting, username)):
236 | txt= "NEED SOME HELP? WHAT YOU NEED TO KNOW IS HERE: \n"
237 | for c in command_list_eng:
238 | txt= txt+ c+ "\n"
239 |
240 | context.bot.send_message(chat_id=update.effective_chat.id, text= txt)
241 |
242 | txt= "TI SERVE UNA MANO? ECCO COSA DEVI SAPERE: \n"
243 | for c in command_list_ita:
244 | txt= txt+ c+ "\n"
245 |
246 | context.bot.send_message(chat_id=update.effective_chat.id, text= txt)
247 |
248 | else:
249 | if( Server.isTesting):
250 | context.bot.send_message(chat_id=update.effective_chat.id, text="Bot in Manutenzione! Torna piu' tardi ;)", reply_markup= markup_video_menu)
251 | context.bot.send_message(chat_id=update.effective_chat.id, text= "Bot under maintenance! Come back later ;)", reply_markup= markup_video_menu)
252 | else:
253 | context.bot.send_message(chat_id=update.effective_chat.id, text="Sei sulla BlackList bro! Fottiti, tu non entri [ Sei Stato Bannato ]", reply_markup= markup_video_menu)
254 | context.bot.send_message(chat_id=update.effective_chat.id, text= "U are on BlackList bro! Fuck u motherfucker [ You have been banned ]", reply_markup= markup_video_menu)
255 |
256 | else:
257 | context.bot.send_message(chat_id=update.effective_chat.id, text= "Session expired, click here to restart --> /start <--", reply_markup= markup_null)
258 |
259 |
260 |
261 |
262 | def categories( update, context):
263 | if update.effective_chat.id in Server.sessions:
264 | username= Server.sessions[ update.effective_chat.id].get_username()
265 |
266 | printText= username+" , "+ str( update.effective_chat.id)+"| /categories"
267 | print( printText)
268 |
269 | thread= threading.Thread( target= send_log_thread, args=[ context, printText])
270 | thread.start()
271 |
272 | categories= Categories()
273 | Server.sessions[ update.effective_chat.id].set_categories( categories)
274 |
275 | nextCategories= ( Server.sessions[ update.effective_chat.id].get_categories()).nextCategory( update, context)
276 | else:
277 | context.bot.send_message(chat_id=update.effective_chat.id, text= "Session expired, click here to restart --> /start <--", reply_markup= markup_null)
278 |
279 |
280 | def nextCategories( update, context):
281 |
282 | if update.effective_chat.id in Server.sessions:
283 | users= Users()
284 | username= Server.sessions[ update.effective_chat.id].get_username()
285 |
286 | if( users.check_user_permission( Server.isTesting, username)):
287 |
288 | username= Server.sessions[ update.effective_chat.id].get_username()
289 |
290 | printText= username+" , "+ str( update.effective_chat.id)+"| /nextCategories"
291 | print( printText)
292 |
293 | thread= threading.Thread( target= send_log_thread, args=[ context, printText])
294 | thread.start()
295 |
296 | nextCategories= ( Server.sessions[ update.effective_chat.id].get_categories()).nextCategory( update, context)
297 | if( nextCategories== "END"):
298 | context.bot.send_message(chat_id=update.effective_chat.id, text="Fine Lista Categorie")
299 |
300 | else:
301 | if( Server.isTesting):
302 | context.bot.send_message(chat_id=update.effective_chat.id, text= "Bot in Manutenzione! Torna piu' tardi ;)", reply_markup= markup_video_menu)
303 | context.bot.send_message(chat_id=update.effective_chat.id, text= "Bot under maintenance! Come back later ;)", reply_markup= markup_video_menu)
304 | else:
305 | context.bot.send_message(chat_id=update.effective_chat.id, text= "Sei sulla BlackList bro! Fottiti, tu non entri [ Sei Stato Bannato ]", reply_markup= markup_video_menu)
306 | context.bot.send_message(chat_id=update.effective_chat.id, text= "U are on BlackList bro! Fuck u motherfucker [ You have been banned ]", reply_markup= markup_video_menu)
307 |
308 | else:
309 | context.bot.send_message(chat_id=update.effective_chat.id, text= "Session expired, click here to restart --> /start <--", reply_markup= markup_null)
310 |
311 | def showCategory( update, context):
312 | if update.effective_chat.id in Server.sessions:
313 | username= Server.sessions[ update.effective_chat.id].get_username()
314 |
315 | printText= username+" , "+ str( update.effective_chat.id)+"| /showCategory"
316 | print( printText)
317 |
318 | thread= threading.Thread( target= send_log_thread, args=[ context, printText])
319 | thread.start()
320 |
321 | vid_not_command( update, context, ( Server.sessions[ update.effective_chat.id].get_categories()).getSelectedCategory( update, context), "user_input")
322 | else:
323 | context.bot.send_message(chat_id=update.effective_chat.id, text= "Session expired, click here to restart --> /start <--", reply_markup= markup_null)
324 |
325 |
326 |
327 | def randomTest( update, context):
328 | markup= ReplyKeyboardMarkup([
329 | [ KeyboardButton( text="Video", callback_data= "/vid")],
330 | [ KeyboardButton( text="Categories", callback_data= "/categories")]
331 |
332 | ])
333 |
334 | context.bot.send_photo(chat_id=update.effective_chat.id, photo="https://di.phncdn.com/is-static/images/categories/(m=q6X556TbetZD8zjadOf)(mh=2MEkxOvC3Z6yb28c)roku_25.jpg", caption= "bella", reply_markup= markup)
335 |
336 |
337 | def vid_not_command( update, context, url, input_type):
338 | thread= threading.Thread( target= vid_not_command_thread, args=[ update, context, url, input_type])
339 | thread.start()
340 | time.sleep( 0.6)
341 |
342 | def vid_not_command_thread( update, context, url, input_type):
343 |
344 | username= Server.sessions[ update.effective_chat.id].get_username()
345 |
346 | users= Users()
347 |
348 | if( users.check_user_permission( Server.isTesting, username)):
349 |
350 | context.bot.send_message(chat_id=update.effective_chat.id, text="😈🥵 Enjoy 🥵😈", reply_markup= markup_video_menu)
351 |
352 | videos= Videos( url, input_type)
353 |
354 | Server.sessions[ update.effective_chat.id].set_videos( videos)
355 |
356 | if( videos.videosTitles== []):
357 | if ( url[0:4]=="http"):
358 | context.bot.send_message(chat_id=update.effective_chat.id, text="Video non Trovato :(\nControlla che il link sia corretto", reply_markup= markup_video_menu)
359 | context.bot.send_message(chat_id=update.effective_chat.id, text="Video not Found :(\nCheck if your link is correct", reply_markup= markup_video_menu)
360 |
361 | else:
362 | context.bot.send_message(chat_id=update.effective_chat.id, text="Nessun video Trovato :(\nAlcune parole o parametri di ricerca non sono consentiti da pornhub poiche potrebbero violare le leggi nazionali vigenti in materia di pornografia", reply_markup= markup_video_menu)
363 | context.bot.send_message(chat_id=update.effective_chat.id, text="We can't find any video :(\nSome words are not allowed by pornhub because they might not be legal in your country", reply_markup= markup_video_menu)
364 |
365 | else:
366 | nextVideo= ( Server.sessions[ update.effective_chat.id].get_videos()).nextVideo( update, context, input_type)
367 |
368 | Server.video_sent= Server.video_sent+1
369 |
370 |
371 | else:
372 | if( Server.isTesting):
373 | context.bot.send_message(chat_id=update.effective_chat.id, text="Bot in Manutenzione! Torna piu' tardi ;)", reply_markup= markup_video_menu)
374 | context.bot.send_message(chat_id=update.effective_chat.id, text= "Bot under maintenance! Come back later ;)", reply_markup= markup_video_menu)
375 | else:
376 | context.bot.send_message(chat_id=update.effective_chat.id, text="Sei sulla BlackList bro! Fottiti, tu non entri [ Sei Stato Bannato ]", reply_markup= markup_video_menu)
377 | context.bot.send_message(chat_id=update.effective_chat.id, text= "U are on BlackList bro! Fuck u motherfucker [ You have been banned ]", reply_markup= markup_video_menu)
378 |
379 |
380 |
381 | def send_log_thread( context, text):
382 | time.sleep(2)
383 | context.bot.send_message(chat_id=-1001493914748, text= text)
384 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | APScheduler==3.6.3
2 | cachetools==4.2.2
3 | certifi==2021.10.8
4 | charset-normalizer==2.0.11
5 | idna==3.3
6 | pytz==2021.3
7 | six==1.16.0
8 | tornado==6.1
9 | tzdata==2021.5
10 | tzlocal==4.1
11 | urllib3==1.26.8
12 |
--------------------------------------------------------------------------------
/users_files/.gitkeep:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------