Uhhy commited on
Commit
8701b0f
·
verified ·
1 Parent(s): 99d92f1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -27
app.py CHANGED
@@ -34,7 +34,7 @@ class VisitRequest(BaseModel):
34
  app.mount("/static", StaticFiles(directory="static"), name="static")
35
 
36
  def get_random_proxy():
37
- pubproxy_url = "http://pubproxy.com/api/proxy?limit=1"
38
  response = requests.get(pubproxy_url, verify=False)
39
  data = response.json()
40
  if data['data']:
@@ -46,7 +46,7 @@ def get_random_proxy():
46
  def get_proxies():
47
  try:
48
  proxies = []
49
- pubproxy_url = "http://pubproxy.com/api/proxy?limit=5"
50
  response = requests.get(pubproxy_url, verify=False)
51
  data = response.json()
52
 
@@ -62,7 +62,8 @@ def get_proxies():
62
  @app.get("/rotate_ip", response_class=PlainTextResponse)
63
  def rotate_ip():
64
  try:
65
- random_ip = fakexd.ipv4()
 
66
 
67
  headers = {
68
  "X-Forwarded-For": random_ip,
@@ -214,10 +215,10 @@ def spotify_login(username: str, password: str):
214
 
215
  def simulate_instagram_view(video_id: str, proxy: str, session: requests.Session):
216
  proxies = {
217
- "http": f"http://{proxy}",
218
- "https": f"http://{proxy}"
219
  }
220
- fake_ipv4 = fakexd.ipv4()
 
221
  headers = {
222
  "User-Agent": fake.user_agent(),
223
  "X-Forwarded-For": fake_ipv4,
@@ -227,7 +228,7 @@ def simulate_instagram_view(video_id: str, proxy: str, session: requests.Session
227
  try:
228
  view_url = f"https://www.instagram.com/reel/{video_id}"
229
  response = session.get(view_url, headers=headers, proxies=proxies)
230
- embed_link = f"https://www.instagram.com/p/{video_id}/embed/"
231
  embed_link_with_start = f"{embed_link}?start={rand(4, 8)}"
232
  print(embed_link_with_start)
233
  except Exception as e:
@@ -235,10 +236,10 @@ def simulate_instagram_view(video_id: str, proxy: str, session: requests.Session
235
 
236
  def simulate_tiktok_view(video_id: str, proxy: str, session: requests.Session):
237
  proxies = {
238
- "http": f"http://{proxy}",
239
- "https": f"http://{proxy}"
240
  }
241
- fake_ipv4 = fakexd.ipv4()
 
242
  headers = {
243
  "User-Agent": fake.user_agent(),
244
  "X-Forwarded-For": fake_ipv4,
@@ -248,7 +249,7 @@ def simulate_tiktok_view(video_id: str, proxy: str, session: requests.Session):
248
  try:
249
  view_url = f"https://www.tiktok.com/@user/video/{video_id}"
250
  response = session.get(view_url, headers=headers, proxies=proxies)
251
- embed_link = f"https://www.tiktok.com/embed/v/{video_id}"
252
  embed_link_with_start = f"{embed_link}?start={rand(4, 8)}"
253
  print(embed_link_with_start)
254
  except Exception as e:
@@ -256,10 +257,10 @@ def simulate_tiktok_view(video_id: str, proxy: str, session: requests.Session):
256
 
257
  def simulate_youtube_view(video_id: str, proxy: str, session: requests.Session):
258
  proxies = {
259
- "http": f"http://{proxy}",
260
- "https": f"http://{proxy}"
261
  }
262
- fake_ipv4 = fakexd.ipv4()
 
263
  headers = {
264
  "User-Agent": fake.user_agent(),
265
  "X-Forwarded-For": fake_ipv4,
@@ -269,7 +270,7 @@ def simulate_youtube_view(video_id: str, proxy: str, session: requests.Session):
269
  try:
270
  view_url = f"https://www.youtube.com/watch?v={video_id}"
271
  response = session.get(view_url, headers=headers, proxies=proxies)
272
- embed_link = f"https://www.youtube.com/embed/{video_id}"
273
  embed_link_with_start = f"{embed_link}?controls=0&start={rand(4, 8)}"
274
  print(embed_link_with_start)
275
  except Exception as e:
@@ -277,10 +278,10 @@ def simulate_youtube_view(video_id: str, proxy: str, session: requests.Session):
277
 
278
  def simulate_facebook_view(video_id: str, proxy: str, session: requests.Session):
279
  proxies = {
280
- "http": f"http://{proxy}",
281
- "https": f"http://{proxy}"
282
  }
283
- fake_ipv4 = fakexd.ipv4()
 
284
  headers = {
285
  "User-Agent": fake.user_agent(),
286
  "X-Forwarded-For": fake_ipv4,
@@ -290,7 +291,7 @@ def simulate_facebook_view(video_id: str, proxy: str, session: requests.Session)
290
  try:
291
  view_url = f"https://www.facebook.com/{video_id}"
292
  response = session.get(view_url, headers=headers, proxies=proxies)
293
- embed_link = f"https://www.facebook.com/plugins/video.php?href=https://www.facebook.com/{video_id}/&show_text=0&width=560&height=315"
294
  embed_link_with_start = f"{embed_link}&start={rand(4, 8)}"
295
  print(embed_link_with_start)
296
  except Exception as e:
@@ -298,10 +299,10 @@ def simulate_facebook_view(video_id: str, proxy: str, session: requests.Session)
298
 
299
  def simulate_twitch_view(video_id: str, proxy: str, session: requests.Session):
300
  proxies = {
301
- "http": f"http://{proxy}",
302
- "https": f"http://{proxy}"
303
  }
304
- fake_ipv4 = fakexd.ipv4()
 
305
  headers = {
306
  "User-Agent": fake.user_agent(),
307
  "X-Forwarded-For": fake_ipv4,
@@ -311,7 +312,7 @@ def simulate_twitch_view(video_id: str, proxy: str, session: requests.Session):
311
  try:
312
  view_url = f"https://www.twitch.tv/videos/{video_id}"
313
  response = session.get(view_url, headers=headers, proxies=proxies)
314
- embed_link = f"https://player.twitch.tv/?video=v{video_id}&parent=www.example.com&autoplay=false&muted=false"
315
  embed_link_with_start = f"{embed_link}&start={rand(4, 8)}"
316
  print(embed_link_with_start)
317
  except Exception as e:
@@ -319,10 +320,10 @@ def simulate_twitch_view(video_id: str, proxy: str, session: requests.Session):
319
 
320
  def simulate_spotify_view(video_id: str, proxy: str, session: requests.Session):
321
  proxies = {
322
- "http": f"http://{proxy}",
323
- "https": f"http://{proxy}"
324
  }
325
- fake_ipv4 = fakexd.ipv4()
 
326
  headers = {
327
  "User-Agent": fake.user_agent(),
328
  "X-Forwarded-For": fake_ipv4,
@@ -332,7 +333,7 @@ def simulate_spotify_view(video_id: str, proxy: str, session: requests.Session):
332
  try:
333
  view_url = f"https://open.spotify.com/track/{video_id}"
334
  response = session.get(view_url, headers=headers, proxies=proxies)
335
- embed_link = f"https://open.spotify.com/embed/track/{video_id}"
336
  embed_link_with_start = f"{embed_link}?start={rand(4, 8)}"
337
  print(embed_link_with_start)
338
  except Exception as e:
 
34
  app.mount("/static", StaticFiles(directory="static"), name="static")
35
 
36
  def get_random_proxy():
37
+ pubproxy_url = "http://pubproxy.com/api/proxy?limit=1&type=http"
38
  response = requests.get(pubproxy_url, verify=False)
39
  data = response.json()
40
  if data['data']:
 
46
  def get_proxies():
47
  try:
48
  proxies = []
49
+ pubproxy_url = "http://pubproxy.com/api/proxy?limit=5&type=http"
50
  response = requests.get(pubproxy_url, verify=False)
51
  data = response.json()
52
 
 
62
  @app.get("/rotate_ip", response_class=PlainTextResponse)
63
  def rotate_ip():
64
  try:
65
+ fake = Faker()
66
+ random_ip = fake.ipv4()
67
 
68
  headers = {
69
  "X-Forwarded-For": random_ip,
 
215
 
216
  def simulate_instagram_view(video_id: str, proxy: str, session: requests.Session):
217
  proxies = {
218
+ "http": f"http://{proxy}"
 
219
  }
220
+ fake = Faker()
221
+ fake_ipv4 = fake.ipv4()
222
  headers = {
223
  "User-Agent": fake.user_agent(),
224
  "X-Forwarded-For": fake_ipv4,
 
228
  try:
229
  view_url = f"https://www.instagram.com/reel/{video_id}"
230
  response = session.get(view_url, headers=headers, proxies=proxies)
231
+ embed_link = f"https://www.instagram.com/p/{video_id}/embed/?autoplay=true"
232
  embed_link_with_start = f"{embed_link}?start={rand(4, 8)}"
233
  print(embed_link_with_start)
234
  except Exception as e:
 
236
 
237
  def simulate_tiktok_view(video_id: str, proxy: str, session: requests.Session):
238
  proxies = {
239
+ "http": f"http://{proxy}"
 
240
  }
241
+ fake = Faker()
242
+ fake_ipv4 = fake.ipv4()
243
  headers = {
244
  "User-Agent": fake.user_agent(),
245
  "X-Forwarded-For": fake_ipv4,
 
249
  try:
250
  view_url = f"https://www.tiktok.com/@user/video/{video_id}"
251
  response = session.get(view_url, headers=headers, proxies=proxies)
252
+ embed_link = f"https://www.tiktok.com/embed/v/{video_id}?autoplay=true"
253
  embed_link_with_start = f"{embed_link}?start={rand(4, 8)}"
254
  print(embed_link_with_start)
255
  except Exception as e:
 
257
 
258
  def simulate_youtube_view(video_id: str, proxy: str, session: requests.Session):
259
  proxies = {
260
+ "http": f"http://{proxy}"
 
261
  }
262
+ fake = Faker()
263
+ fake_ipv4 = fake.ipv4()
264
  headers = {
265
  "User-Agent": fake.user_agent(),
266
  "X-Forwarded-For": fake_ipv4,
 
270
  try:
271
  view_url = f"https://www.youtube.com/watch?v={video_id}"
272
  response = session.get(view_url, headers=headers, proxies=proxies)
273
+ embed_link = f"https://www.youtube.com/embed/{video_id}?autoplay=true"
274
  embed_link_with_start = f"{embed_link}?controls=0&start={rand(4, 8)}"
275
  print(embed_link_with_start)
276
  except Exception as e:
 
278
 
279
  def simulate_facebook_view(video_id: str, proxy: str, session: requests.Session):
280
  proxies = {
281
+ "http": f"http://{proxy}"
 
282
  }
283
+ fake = Faker()
284
+ fake_ipv4 = fake.ipv4()
285
  headers = {
286
  "User-Agent": fake.user_agent(),
287
  "X-Forwarded-For": fake_ipv4,
 
291
  try:
292
  view_url = f"https://www.facebook.com/{video_id}"
293
  response = session.get(view_url, headers=headers, proxies=proxies)
294
+ embed_link = f"https://www.facebook.com/plugins/video.php?href=https://www.facebook.com/{video_id}/&show_text=0&width=560&height=315&autoplay=true"
295
  embed_link_with_start = f"{embed_link}&start={rand(4, 8)}"
296
  print(embed_link_with_start)
297
  except Exception as e:
 
299
 
300
  def simulate_twitch_view(video_id: str, proxy: str, session: requests.Session):
301
  proxies = {
302
+ "http": f"http://{proxy}"
 
303
  }
304
+ fake = Faker()
305
+ fake_ipv4 = fake.ipv4()
306
  headers = {
307
  "User-Agent": fake.user_agent(),
308
  "X-Forwarded-For": fake_ipv4,
 
312
  try:
313
  view_url = f"https://www.twitch.tv/videos/{video_id}"
314
  response = session.get(view_url, headers=headers, proxies=proxies)
315
+ embed_link = f"https://player.twitch.tv/?video=v{video_id}&parent=www.example.com&autoplay=true&muted=false"
316
  embed_link_with_start = f"{embed_link}&start={rand(4, 8)}"
317
  print(embed_link_with_start)
318
  except Exception as e:
 
320
 
321
  def simulate_spotify_view(video_id: str, proxy: str, session: requests.Session):
322
  proxies = {
323
+ "http": f"http://{proxy}"
 
324
  }
325
+ fake = Faker()
326
+ fake_ipv4 = fake.ipv4()
327
  headers = {
328
  "User-Agent": fake.user_agent(),
329
  "X-Forwarded-For": fake_ipv4,
 
333
  try:
334
  view_url = f"https://open.spotify.com/track/{video_id}"
335
  response = session.get(view_url, headers=headers, proxies=proxies)
336
+ embed_link = f"https://open.spotify.com/embed/track/{video_id}?autoplay=true"
337
  embed_link_with_start = f"{embed_link}?start={rand(4, 8)}"
338
  print(embed_link_with_start)
339
  except Exception as e: