So im just experimenting, trying to parse through the web using python and i thought i would try to make a script that would search for my favorite links to watch shows online. Im trying to now have my program search through sidereel.com for a good link to my desired show and return to me the links. I know that the site saves the links in the following format:
watch-freeseries.mu’then some long string that i need to ignore followed by ‘14792088’
So what i need to be able to do is to find this string in the txt file of the site and return to me only the 8 numbers at the end of the string. I not sure how i can get to the numbers and i need them because they are the link number. Any help would be much appreciated
You could use a regular expression to do this fairly easily.
A breakdown of the expression:
watch\-freeseries\.mu– Match the start of the expected expression. Escape any possible special characters by preceding them with\..*?– Match any character..means any character and*means that appear one after the other an infinite amount of times. The?is to perform a non-greedy match so that the match will not overlap if two or more urls show up in the same string.(\d{8})– Match and save the last 8 digitsNote: If you’re trying to parse links out of a webpage there are easier ways. I’ve seen many recommendations on StackOverflow for the BeautifulSoup package in particular. I’ve never used it myself so YMMV.