H4CK3R-5M4CK3R commited on
Commit
7822a84
·
1 Parent(s): 7bed2d8

Updated code new code added

Browse files
Files changed (3) hide show
  1. app.py +30 -12
  2. files/logo.png +0 -0
  3. notification.mp3 +0 -0
app.py CHANGED
@@ -21,6 +21,8 @@ auth = [
21
  ]
22
 
23
  description = """
 
 
24
  For bug reports or improvements, contact [@H4CK3R_5M4CK3R](https://t.me/H4CK3R_5M4CK3R) on Telegram.
25
 
26
  **Usage Instructions:**
@@ -34,6 +36,7 @@ For bug reports or improvements, contact [@H4CK3R_5M4CK3R](https://t.me/H4CK3R_5
34
  - Define the range for volumes, not issues. Ensure you pass the volume range correctly.
35
  - To pass the range you must have use () in start of the url something like (to:from)-link/{v}/{i} checkout example below.
36
  - Now you can also pass the multiple links too and add range into same as above.
 
37
 
38
  3. **Read this before using google sheet feature**
39
  - **IMPORTANT** First make a google drive folder and then gave access to `[email protected]` and `[email protected]` super important.
@@ -58,15 +61,15 @@ If you are copying this space make sure to contact the owner as mention above
58
  exmpl = [
59
  ["https://www.ams.org/journals/jams/2024-37-01/home.html?active=allissues", "[email protected]", "asdfasdfasdfasdfasdf", "example1", True, True, False],
60
  ["https://www.degruyter.com/journal/key/fca/20/2/html", "[email protected]", "asdfasdfasdfasdfasdf", "example2", True, True, False],
61
- ["(22:23)-https://www.degruyter.com/journal/key/fca/{v}/{i}/html", "[email protected]", "asdfasdfasdfasdfasdf", "example3", True, True, False],
62
  ["https://www.aimspress.com/math/article/2024/8/archive-articles", "[email protected]", "asdfasdfasdfasdfasdf", "example4", True, True, False],
63
- ["(2021:2022)-https://www.aimspress.com/math/article/{v}/{i}/archive-articles", "[email protected]", "asdfasdfasdfasdfasdf", "example5", True, True, False],
64
  ["https://link.springer.com/journal/208/volumes-and-issues/388-3", "[email protected]", "asdfasdfasdfasdfasdf", "example6", True, True, False],
65
  ["(388:389)-https://link.springer.com/journal/208/volumes-and-issues/{v}-{i}", "[email protected]", "asdfasdfasdfasdfasdf", "example7", True, True, False],
66
  ["https://www.sciencedirect.com/journal/advances-in-applied-mathematics/vol/158/suppl/C", "[email protected]", "asdfasdfasdfasdfasdf", "example8", True, True, False],
67
  ["https://www.sciencedirect.com/journal/acta-mathematica-scientia/vol/38/issue/6", "[email protected]", "asdfasdfasdfasdfasdf", "example9", True, True, False],
68
  ["(37:38)-https://www.sciencedirect.com/journal/acta-mathematica-scientia/vol/{v}/issue/{i}", "[email protected]", "asdfasdfasdfasdfasdf", "example10", True, True, False],
69
- ["(37:38)-https://www.sciencedirect.com/journal/acta-mathematica-scientia/vol/{v}/issue/{i}\n(388:389)-https://link.springer.com/journal/208/volumes-and-issues/{v}-{i}\n(2021:2022)-https://www.aimspress.com/math/article/{v}/{i}/archive-articles\n(22:23)-https://www.degruyter.com/journal/key/fca/{v}/{i}/html", "[email protected]", "asdfasdfasdfasdfasdf", "example11", True, True, False]
70
  ]
71
 
72
  stop_work = False
@@ -374,8 +377,9 @@ def handle_url(Link: str, Gmail: str, FolderId: str, Output: str, MakeOwner:bool
374
  authors = []
375
  details = []
376
  final_output = None
377
- multi_output = None
378
  link = None
 
379
  From_volume = 0
380
  To_Volume = 0
381
  urls = []
@@ -388,8 +392,12 @@ def handle_url(Link: str, Gmail: str, FolderId: str, Output: str, MakeOwner:bool
388
  print(f"URLS : {urls}")
389
  for url in urls:
390
  if url.startswith("("):
391
- From_volume = int(url.split("(", 1)[1].split(":")[0])
392
  To_Volume = int(url.split("(", 1)[1].split(":")[1].split(")", 1)[0])
 
 
 
 
393
  url = url.split("-", 1)[1].strip()
394
  try:
395
  credit = crypto.decrypt(os.getenv("KEY"), os.getenv("GOOGLE_AUTH_CREDENTIALS"))
@@ -402,8 +410,11 @@ def handle_url(Link: str, Gmail: str, FolderId: str, Output: str, MakeOwner:bool
402
  if multiUrls == False:
403
  final_output = result["final_output"]
404
  else:
405
- multi_output = result["final_output"]
406
- link = result["link"]
 
 
 
407
  else:
408
  if "author" in result:
409
  author = result["author"]
@@ -415,9 +426,14 @@ def handle_url(Link: str, Gmail: str, FolderId: str, Output: str, MakeOwner:bool
415
  details = details[-3:] if len(details) > 3 else details
416
  if multiUrls:
417
  final_output = None
418
- yield "\n".join(authors), "\n".join(details), final_output if final_output else None, gr.Audio("notification.mp3", autoplay=True) if final_output else None, link
419
- if multiUrls == True:
420
- yield "\n".join(authors), "\n".join(details), multi_output, gr.Audio("notification.mp3", autoplay=True), link
 
 
 
 
 
421
 
422
  interface = gr.Interface(
423
  fn=handle_url,
@@ -426,11 +442,13 @@ interface = gr.Interface(
426
  title="Web Scraper",
427
  description=description,
428
  examples=exmpl,
429
- cache_examples=False
 
430
  )
431
 
432
  interface.launch(
433
  share=False,
434
  show_api=False,
435
- auth=auth
 
436
  )
 
21
  ]
22
 
23
  description = """
24
+ ![Logo](file=files/logo.png)
25
+
26
  For bug reports or improvements, contact [@H4CK3R_5M4CK3R](https://t.me/H4CK3R_5M4CK3R) on Telegram.
27
 
28
  **Usage Instructions:**
 
36
  - Define the range for volumes, not issues. Ensure you pass the volume range correctly.
37
  - To pass the range you must have use () in start of the url something like (to:from)-link/{v}/{i} checkout example below.
38
  - Now you can also pass the multiple links too and add range into same as above.
39
+ - For multiple output file you must have to specific the name in the head of the url like (to:from:output) checkout example's
40
 
41
  3. **Read this before using google sheet feature**
42
  - **IMPORTANT** First make a google drive folder and then gave access to `[email protected]` and `[email protected]` super important.
 
61
  exmpl = [
62
  ["https://www.ams.org/journals/jams/2024-37-01/home.html?active=allissues", "[email protected]", "asdfasdfasdfasdfasdf", "example1", True, True, False],
63
  ["https://www.degruyter.com/journal/key/fca/20/2/html", "[email protected]", "asdfasdfasdfasdfasdf", "example2", True, True, False],
64
+ ["(22:23:example3)-https://www.degruyter.com/journal/key/fca/{v}/{i}/html", "[email protected]", "asdfasdfasdfasdfasdf", "example3", True, True, False],
65
  ["https://www.aimspress.com/math/article/2024/8/archive-articles", "[email protected]", "asdfasdfasdfasdfasdf", "example4", True, True, False],
66
+ ["(2021:2022:example5)-https://www.aimspress.com/math/article/{v}/{i}/archive-articles", "[email protected]", "asdfasdfasdfasdfasdf", "example5", True, True, False],
67
  ["https://link.springer.com/journal/208/volumes-and-issues/388-3", "[email protected]", "asdfasdfasdfasdfasdf", "example6", True, True, False],
68
  ["(388:389)-https://link.springer.com/journal/208/volumes-and-issues/{v}-{i}", "[email protected]", "asdfasdfasdfasdfasdf", "example7", True, True, False],
69
  ["https://www.sciencedirect.com/journal/advances-in-applied-mathematics/vol/158/suppl/C", "[email protected]", "asdfasdfasdfasdfasdf", "example8", True, True, False],
70
  ["https://www.sciencedirect.com/journal/acta-mathematica-scientia/vol/38/issue/6", "[email protected]", "asdfasdfasdfasdfasdf", "example9", True, True, False],
71
  ["(37:38)-https://www.sciencedirect.com/journal/acta-mathematica-scientia/vol/{v}/issue/{i}", "[email protected]", "asdfasdfasdfasdfasdf", "example10", True, True, False],
72
+ ["(37:38:example11)-https://www.sciencedirect.com/journal/acta-mathematica-scientia/vol/{v}/issue/{i}\n(388:389:example12)-https://link.springer.com/journal/208/volumes-and-issues/{v}-{i}\n(2021:2022:example13)-https://www.aimspress.com/math/article/{v}/{i}/archive-articles\n(22:23:example14)-https://www.degruyter.com/journal/key/fca/{v}/{i}/html", "[email protected]", "asdfasdfasdfasdfasdf", "example11", True, True, False]
73
  ]
74
 
75
  stop_work = False
 
377
  authors = []
378
  details = []
379
  final_output = None
380
+ final_outputs = []
381
  link = None
382
+ links = []
383
  From_volume = 0
384
  To_Volume = 0
385
  urls = []
 
392
  print(f"URLS : {urls}")
393
  for url in urls:
394
  if url.startswith("("):
395
+ From_volume = int(url.split("(", 1)[1].split(":", 1)[0])
396
  To_Volume = int(url.split("(", 1)[1].split(":")[1].split(")", 1)[0])
397
+ try:
398
+ Output = url.split("(", 1)[1].split(":")[2].split(")", 1)[0]
399
+ except:
400
+ raise gr.Error(f"No output found for {url} you must need to specify the output")
401
  url = url.split("-", 1)[1].strip()
402
  try:
403
  credit = crypto.decrypt(os.getenv("KEY"), os.getenv("GOOGLE_AUTH_CREDENTIALS"))
 
410
  if multiUrls == False:
411
  final_output = result["final_output"]
412
  else:
413
+ final_outputs.append(result["final_output"])
414
+ if multiUrls:
415
+ link = result["link"]
416
+ else:
417
+ links.append(result["link"])
418
  else:
419
  if "author" in result:
420
  author = result["author"]
 
426
  details = details[-3:] if len(details) > 3 else details
427
  if multiUrls:
428
  final_output = None
429
+ if multiUrls:
430
+ yield "\n".join(authors), "\n".join(details), None, None, None
431
+ else:
432
+ yield "\n".join(authors), "\n".join(details), final_output if final_output else None, gr.Audio("notification.mp3", autoplay=True) if final_output else None, link if final_output else None
433
+ if multiUrls == True:
434
+ yield "\n".join(authors), "\n".join(details), final_outputs, gr.Audio("notification.mp3", autoplay=True), links
435
+ else:
436
+ yield "\n".join(authors), "\n".join(details), final_output, gr.Audio("notification.mp3", autoplay=True), links
437
 
438
  interface = gr.Interface(
439
  fn=handle_url,
 
442
  title="Web Scraper",
443
  description=description,
444
  examples=exmpl,
445
+ cache_examples=False,
446
+ thumbnail="logo.png"
447
  )
448
 
449
  interface.launch(
450
  share=False,
451
  show_api=False,
452
+ allowed_paths=["files"]
453
+ # auth=auth
454
  )
files/logo.png ADDED
notification.mp3 CHANGED
Binary files a/notification.mp3 and b/notification.mp3 differ