Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def UrlConstructor(self, date_list):
- urlcommon = "https://ria.ru/politics/"
- index = 0
- current_day = date_list[index]
- lst = ['{0:09d}'.format(j) for j in xrange(1485048700, 1487000000)]
- for i in lst:
- print i
- url = urlcommon + str(current_day).replace("-", '') + "/" + i + ".html"
- print url
- if self.CheckValid(url) == True:
- with codecs.open("listOfArticlePaths.txt", 'a') as f:
- f.write(url + "\n")
- print("я нашел статью и записал ее, вот: " + url)
- else:
- if index+1 < len(date_list):
- url = urlcommon + str(date_list[index+1]).replace("-", '') + "/" + i + ".html"
- if self.CheckValid(url) == True:
- current_day = date_list[index+1]
- else:
- return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement