I have tried using all the iterating methods but still getting the same error, I have tried using itertools.zip_longest but still giving me the same error
def find_occurrences(content_string):
start_indices = []
end_indices = []
for i in range(len(content_string)):
if content_string.startswith("https://www.nytimes.com/2022", i):
start_indices.append(i)
if content_string.startswith(".html", i):
end_indices.append(i+5)
#print(start_indices)
#print(end_indices)
find_occurrences(content_string)
def get_all_urls(start_indices, end_indices, content_string ):
url_list = []
for (i) in range (len(start_indices)):
url_list.append(content_string [start_indices[i]:end_indices[i]])
return url_list
content_string = get_content_string("https://www.nytimes.com/section/technology")
start_indices, end_indices = find_occurrences(content_string)
url_list = get_all_urls(start_indices, end_indices, content_string)
this is the error I amm getting
Exception has occurred: TypeError
cannot unpack non-iterable NoneType object
File "C:\Users\HP\OneDrive\Desktop\Newspaper Aggregator\projects\news_extract.py", line 52, in <module>
start_indices, end_indices = find_occurrences(content_string)