Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

patent number to PDF #6

Open
goldengrape opened this issue Apr 19, 2023 · 0 comments
Open

patent number to PDF #6

goldengrape opened this issue Apr 19, 2023 · 0 comments

Comments

@goldengrape
Copy link

import re
import requests

ID = "WO2010019397A2"
url = f"https://patents.google.com/patent/{ID}/"

response = requests.get(url)

if response.status_code == 200:
    html = response.text
    pattern = r"https://patentimages\.storage\.googleapis\.com/([\w/]+)/" + re.escape(ID) + r"\.pdf"
    
    match = re.search(pattern, html)
    if match:
        extracted_url = match.group(0)
        print(extracted_url)
    else:
        print("No match found")
else:
    print(f"Failed to fetch the web page. Status code: {response.status_code}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant