Python: find all urls which contain string
<p>I am trying to find all pages that contain a certain string in the name, on a certain domain. For example: </p>

<pre><code>www.example.com/section/subsection/406751371-some-string 
www.example.com/section/subsection/235824297-some-string 
www.example.com/section/subsection/146783214-some-string
</code></pre>

<p>What would be the best way to do it?</p>

<p>The numbers before "-some-string" can be any 9-digit number. I can write a script that loops through all possible 9-digit numbers and tries to access the resulting url, but I keep thinking that there should be a more efficient way to do this, especially since I know that overall there are only about 1000 possible pages that end with that string. </p>

<p>If these articles are all linked to on one page you could parse the html of this index page since all links will be contained in the href tags.</p>

python url