title: Unable to make my script produce a particular output
body: <p>I'm trying to create a script in Python to fetch all the links connected to the name of different actors from imdb.com and then parse the first three of their movie links and finally scrape the name of director and writer of those movies. There are around 1000 names in there. I'm okay with the first three names for this example. </p>
  
  <p><strong><a href="https://www.imdb.com/list/ls058011111/" rel="nofollow noreferrer">Website link</a></strong></p>
  
  <p>I can scrape the links of different <code>actors</code> and their first three movie <code>links</code> in one go.</p>
  
  <pre><code>import requests
  from bs4 import BeautifulSoup
  from urllib.parse import urljoin
  
  url = 'https://www.imdb.com/list/ls058011111/'
  base = 'https://www.imdb.com/'
  
  def get_actor_list(s):
      res = s.get(url,headers={"User-Agent":"Mozilla/5.0"})
      soup = BeautifulSoup(res.text,"lxml")
      for name_links in soup.select(".mode-detail")[:3]:
          name = name_links.select_one("h3 &gt; a").get_text(strip=True)
          item_link = urljoin(base,name_links.select_one("h3 &gt; a").get("href"))
          yield from get_movie_links(s,name,item_link)
  
  def get_movie_links(s,name,link):
      r = s.get(link)
      soup = BeautifulSoup(r.text,"lxml")
      item_links = [urljoin(base,item.get("href")) for item in soup.select(".filmo-category-section .filmo-row &gt; b &gt; a[href]")[:3]]
      yield name,item_links
  
  if __name__ == '__main__':
      with requests.Session() as s:
          for elem in get_actor_list(s):
              print(elem)
  </code></pre>
  
  <p>The result I get:</p>
  
  <pre><code>('Robert De Niro', ['https://www.imdb.com/title/tt4075436/', 'https://www.imdb.com/title/tt3143812/', 'https://www.imdb.com/title/tt5537002/'])
  ('Jack Nicholson', ['https://www.imdb.com/title/tt1341188/', 'https://www.imdb.com/title/tt1356864/', 'https://www.imdb.com/title/tt0825232/'])
  ('Marlon Brando', ['https://www.imdb.com/title/tt10905860/', 'https://www.imdb.com/title/tt0442674/', 'https://www.imdb.com/title/tt1667880/'])
  </code></pre>
  
  <p>I can even parse the name of <code>directors</code> and the <code>writers</code> of those linked movies if I individually use those links within the following function:</p>
  
  <pre><code>def get_content(s,url):
      res = s.get(url,headers={"User-Agent":"Mozilla/5.0"})
      soup = BeautifulSoup(res.text,"lxml")
      director = soup.select_one("h4:contains('Director') ~ a")
      director = director.get_text(strip=True) if director else None
      writer = soup.select_one("h4:contains('Writer') ~ a").get_text(strip=True)
      print(director,writer)
  </code></pre>
  
  <p>However, I would like to rectify the script merging those functions in such a way so that it produces the following (final) output:</p>
  
  <pre><code>('Robert De Niro', [Jonathan Jakubowicz, Jonathan Jakubowicz,  None, Anthony Thorne, Martin Scorsese, David Grann])
  ('Jack Nicholson', [James L. Brooks, James L. Brooks, Casey Affleck, Casey Affleck, Rob Reiner, Justin Zackham])
  ('Marlon Brando', [Bob Bendetson, Bob Bendetson, Peter Mitchell, Rubin Mario Puzo, Paul Hunter, Paul Hunter])
  </code></pre>
  
  <p>How can I get the final output merging the above functions in the right way?</p>