title: how to scrape the text body from multiple pages based on urls in a txt file
body: <p>I tried to write a code that calls several URLs and then saves the entire scraped text in a txt file, but I can not figure out where to implement a loop function without breaking everything.</p>
  <p>that's how the code looks right now:</p>
  <pre><code>import requests
  from bs4 import BeautifulSoup
  from fake_useragent import UserAgent
  from dhooks import Webhook, Embed
  
  
  def getReadMe():
      with open('urls.txt','r') as file:
          return file.read()
  
  def getHtml(readMe):
      ua = UserAgent()
      header = {'user-agent':ua.random}
      response = requests.get(readMe,headers=header,timeout=3)
      response.raise_for_status() 
      return response.content
  
  readMe = getReadMe()
  
  
  print(readMe)
  
  
  html = getHtml(readMe)
  soup = BeautifulSoup(html, 'html.parser')
  text = soup.find_all(text=True)
  
  
  output =''
  
  
  blacklist = [
      '[document]',
      'noscript',
      'header',
      'html',
      'meta',
      'head', 
      'input',
      'script',
      'style'
      
  ]
  
  
  for t in text:
      if t.parent.name not in blacklist:
          output += '{} '.format(t)
  
  print(output)
  
  with open(&quot;copy.txt&quot;, &quot;w&quot;) as file:
      file.write(str(output))
  </code></pre>