[Python] How To Extract URLs From a Hindi Newspaper Amar Ujala

Discussão em 'Python' iniciado por Stack, Fevereiro 19, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to extract the url of articles present on a Hindi Newspaper called Amar Ujala. Link: https://www.amarujala.com/india-news?src=mainmenu

    In 'Network' section of Dev Tools, It seems required API is 'https://electionresultapi.amarujala.com/get-article-reactions' and under the 'payload' section we have the required URL. [​IMG]

    I tried the following code to fetch the URL

    import requests
    import json

    # Assuming you have an API key, replace 'YOUR_API_KEY' with your actual API key
    headers = {
    'Authorization': 'Bearer Your_Auth'
    }

    api_response = requests.post('https://electionresultapi.amarujala.com/get-article-reactions', headers=headers)
    print(api_response.status_code)

    data = api_response.text
    parse_json = json.loads(data)
    print(parse_json)



    But as expected it is giving output from 'Response' section of Dev Tools. How to extract URL from the weblink shared above.

    Continue reading...

Compartilhe esta Página