Click here to Skip to main content
15,889,116 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
df = pd.read_excel('Input.xlsx', nrows=114)

# Define a function to extract the URL and URL_ID from a row
def extract_url_id(row):
  return row['URL'], row['URL_ID']

# Apply the function to each row and extract the URL and URL_ID

urls, url_ids = zip(*df.apply(extract_url_id, axis=1))

print(urls)
print(url_ids)

# Extract the URLs from the DataFrame
urls = df['URL'].tolist()

# Iterate over the URLs
for url in urls:
 
 # Make a request to the URL
 
 r = requests.get(url)

  # Extract the HTML from the response

  html = r.text


What I have tried:

r=request.get(url) is not working properly. i need to get Urls text data in order to save the extracted article in a text file with URL_ID as its file name. error typically indicates that there was an issue establishing a connection ..
Posted
Updated 3-Jan-23 0:46am

1 solution

Quote:
error typically indicates that there was an issue establishing a connection
That is not something that anyone here can help you with. You need to check with the owners of the site.
 
Share this answer
 
Comments
Bisma Hilal 3-Jan-23 6:49am    
the owners of the site have provided the links themselves, i think its because of the way im extracting these links from the file and requesting the connection to them?
Richard MacCutchan 3-Jan-23 7:11am    
Well there is still nothing that anyone here can do to make the connection work.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900