Site hosted by Angelfire.com: Build your free website today!

"""

from bs4 import BeautifulSoup as bs4

import requests

import codecs

import sys


#create html holder

htmlholder = 'C:/Users/Bravera/Documents/Python/IDLEAIKA/htmlholder.txt'

htmlholderr = open(htmlholder,'w')

Html_file=codecs.open("filename.html","w","utf-8")

Html_opener= """<!DOCTYPE html>

<html>

<body>

"""

Html_closer= """</body>

</html>

"""

Html_file.write(Html_opener)

for x in range(10000,11000):

    #update url

    html="https://www.ancient-forums.com/viewtopic.php?f=24&t=%d"%x

    #get title

    r=requests.get(html)

    c=r.content

    soup=bs4(c,'html.parser')


    

    check=soup.title.string

    #check title

    if check.string !=  'Joy Of Satan Forums - Information':

        if check.endswith(' - Joy Of Satan Forums'):

            check.string = check[:-22]


        

        Html_file.write('<a href="%s">%s</a>'%(html,check.string)+ " <br>"+'\n')

        

        

Html_file.write(Html_closer)

htmlholderr.close()

Html_file.close()

"""