Discord Bot and BeautfiulSoup webscraping project returning maximum recursion depth error

0

First time using Stack Overflow, so apologies if this was formatted horrendously.

A few months ago, I decided to start a web scraping project in combination with the discord.py module to generate a set of 3 random songs in Dance Dance Revolution that users can request on Discord. The song names and jacket images were scraped from a rhythm game related website called remywiki. The programming was working fine a while back. However, I'm getting this error now whenever I try to launch the .py file that starts the Discord bot:

Traceback (most recent call last):
  File "c:\Users\Kevin\.vscode\extensions\ms-python.python-2019.11.50794\pythonFiles\lib\python\old_ptvsd\ptvsd\_vendored\pydevd\_pydevd_bundle\pydevd_trace_dispatch_regular.py", line 412, in __call__
    if frame_cache_key in cache_skips:
RecursionError: maximum recursion depth exceeded in comparison
Fatal Python error: Cannot recover from stack overflow.

Thread 0x00001158 (most recent call first):
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\gevent\_threading.py", line 84 in wait
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\gevent\_threading.py", line 166 in get
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\gevent\threadpool.py", line 270 in _worker

Thread 0x00002c34 (most recent call first):
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\gevent\_threading.py", line 84 in wait
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\gevent\_threading.py", line 166 in get
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\gevent\threadpool.py", line 270 in _worker

Thread 0x00001340 (most recent call first):
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\gevent\_threading.py", line 84 in wait
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\gevent\_threading.py", line 166 in get
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\gevent\threadpool.py", line 270 in _worker

Thread 0x00001454 (most recent call first):
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\gevent\_threading.py", line 84 in wait
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\gevent\_threading.py", line 166 in get
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\gevent\threadpool.py", line 270 in _worker

Thread 0x000026ec (most recent call first):
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\gevent\_threading.py", line 84 in wait
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\gevent\_threading.py", line 166 in get
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\gevent\threadpool.py", line 270 in _worker

Thread 0x000010c8 (most recent call first):
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\gevent\_threading.py", line 84 in wait
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\gevent\_threading.py", line 166 in get
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\gevent\threadpool.py", line 270 in _worker

Thread 0x000043cc (most recent call first):
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\gevent\_threading.py", line 84 in wait
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\gevent\_threading.py", line 166 in get
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\gevent\threadpool.py", line 270 in _worker

Thread 0x00001798 (most recent call first):
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\gevent\_threading.py", line 84 in wait
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\gevent\_threading.py", line 166 in get
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\gevent\threadpool.py", line 270 in _worker

Thread 0x000037d4 (most recent call first):
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\gevent\_threading.py", line 84 in wait
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\gevent\_threading.py", line 166 in get
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\gevent\threadpool.py", line 270 in _worker

Thread 0x00001ffc (most recent call first):
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\gevent\_threading.py", line 84 in wait
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\gevent\_threading.py", line 166 in get
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\gevent\threadpool.py", line 270 in _worker

Thread 0x0000157c (most recent call first):
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\gevent\libuv\loop.py", line 473 in run
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\gevent\hub.py", line 582 in run

Thread 0x000008e0 (most recent call first):
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 300 in wait
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 552 in wait
  File "c:\Users\Kevin\.vscode\extensions\ms-python.python-2019.11.50794\pythonFiles\lib\python\old_ptvsd\ptvsd\_vendored\pydevd\pydevd.py", line 171 in _on_run
  File "c:\Users\Kevin\.vscode\extensions\ms-python.python-2019.11.50794\pythonFiles\lib\python\old_ptvsd\ptvsd\_vendored\pydevd\_pydevd_bundle\pydevd_comm.py", line 149 in run
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 926 in _bootstrap_inner
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 890 in _bootstrap

Thread 0x000014f4 (most recent call first):
  File "c:\Users\Kevin\.vscode\extensions\ms-python.python-2019.11.50794\pythonFiles\lib\python\old_ptvsd\ptvsd\wrapper.py", line 168 in recv
  File "c:\Users\Kevin\.vscode\extensions\ms-python.python-2019.11.50794\pythonFiles\lib\python\old_ptvsd\ptvsd\_vendored\pydevd\_pydevd_bundle\pydevd_comm.py", line 248 in _read_line
  File "c:\Users\Kevin\.vscode\extensions\ms-python.python-2019.11.50794\pythonFiles\lib\python\old_ptvsd\ptvsd\_vendored\pydevd\_pydevd_bundle\pydevd_comm.py", line 262 in _on_run
  File "c:\Users\Kevin\.vscode\extensions\ms-python.python-2019.11.50794\pythonFiles\lib\python\old_ptvsd\ptvsd\_vendored\pydevd\_pydevd_bundle\pydevd_comm.py", line 149 in run
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 926 in _bootstrap_inner
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 890 in _bootstrap

Thread 0x00003064 (most recent call first):
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 300 in wait
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\queue.py", line 179 in get
  File "c:\Users\Kevin\.vscode\extensions\ms-python.python-2019.11.50794\pythonFiles\lib\python\old_ptvsd\ptvsd\_vendored\pydevd\_pydevd_bundle\pydevd_comm.py", line 362 in _on_run
  File "c:\Users\Kevin\.vscode\extensions\ms-python.python-2019.11.50794\pythonFiles\lib\python\old_ptvsd\ptvsd\_vendored\pydevd\_pydevd_bundle\pydevd_comm.py", line 149 in run
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 926 in _bootstrap_inner
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 890 in _bootstrap

Thread 0x00002144 (most recent call first):
  File "c:\Users\Kevin\.vscode\extensions\ms-python.python-2019.11.50794\pythonFiles\lib\python\old_ptvsd\ptvsd\ipcjson.py", line 113 in _buffered_read_line_as_ascii
  File "c:\Users\Kevin\.vscode\extensions\ms-python.python-2019.11.50794\pythonFiles\lib\python\old_ptvsd\ptvsd\ipcjson.py", line 154 in _wait_for_message
  File "c:\Users\Kevin\.vscode\extensions\ms-python.python-2019.11.50794\pythonFiles\lib\python\old_ptvsd\ptvsd\ipcjson.py", line 272 in process_one_message
  File "c:\Users\Kevin\.vscode\extensions\ms-python.python-2019.11.50794\pythonFiles\lib\python\old_ptvsd\ptvsd\ipcjson.py", line 258 in process_messages
  File "c:\Users\Kevin\.vscode\extensions\ms-python.python-2019.11.50794\pythonFiles\lib\python\old_ptvsd\ptvsd\wrapper.py", line 521 in process_messages
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 870 in run
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 926 in _bootstrap_inner
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 890 in _bootstrap

Thread 0x00001f0c (most recent call first):
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 300 in wait
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 552 in wait
  File "c:\Users\Kevin\.vscode\extensions\ms-python.python-2019.11.50794\pythonFiles\lib\python\old_ptvsd\ptvsd\futures.py", line 122 in run_forever
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 870 in run
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 926 in _bootstrap_inner
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 890 in _bootstrap

Current thread 0x00001258 (most recent call first):
  File "c:\Users\Kevin\.vscode\extensions\ms-python.python-2019.11.50794\pythonFiles\lib\python\old_ptvsd\ptvsd\_vendored\pydevd\_pydevd_bundle\pydevd_trace_dispatch_regular.py", line 412 in __call__
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 516 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options
  File "C:\Users\Kevin\AppData\Local\Programs\Python\Python37-32\lib\ssl.py", line 518 in options

Here is the .py file that starts the bot:

import discord
import sys
import os
from ritext import img_txt
from song_collector import remy_links, titles
from jacket_collect import*
from jacketcollage import collager, images
from discord.ext import commands


bot = commands.Bot(command_prefix = '$', description = 'A DDR bot that generates memes and songs')
channel = bot.get_channel(594197266668191768)



@bot.event
async def on_ready():
    print('{0.user} is now online'.format(bot))
    await bot.change_presence(activity = discord.Game(name = '19s with no-bar'))

@bot.event
async def on_message(message):
    if message.author == bot.user:
        return

    user = message.author.name
    msg = message.content
    print(f"{user} said {msg}")

    await bot.process_commands(message)

@bot.command()
async def randomset(ctx):

    stage_num = 1

    song_set = enumerate(random.sample((img_jacket), k = 3))
    index_num = [jacket[0] for jacket in song_set]
    final_set = [jacket[1] for jacket in song_set]

    print(index_num)
    print(final_set)

    collager(final_set)

    await channel.send(file = discord.File('e.png'))
    os.remove('e.png')

    embed = discord.Embed(title = "Random Set", description = "Good luck", color = discord.Color.magenta())

    for index in index_num:
        name = titles[index]
        link = remy_links[index]
        embed.add_field(name = f"Stage #{stage_num}", value = f"[{name}]({link})", inline = False)
        stage_num += 1


    images.clear()
    final_set.clear()
    index_num.clear()
    await ctx.send(embed = embed) 

bot.run('')

I believe my error comes somewhere from using BS incorrectly, but I can't figure out where I messed up exactly. Also, I used grequests to help speed up parsing of all the song titles from the website as doing this non-asynchronously would take ages.

Here is part of the code that uses BS. SO doesn't suggest uploading the entirety of my code, but more can be provided upon request.

import grequests
import requests
import random
import time
from song_collector import*
from bs4 import BeautifulSoup as bs

img_file = []
img_jacket = []
remove_list = []



def jacket():
    index_num = 0

    reqs = (grequests.get(song) for song in remy_links)
    resp = grequests.map(reqs)
    for response in resp:
        soup2 = bs(response.content, 'lxml')
        try:
            fileclass = soup2.find('div', class_= 'thumbinner')
            filelink = fileclass.find('a', href = True)
            wrem = remy_url + filelink['href']
            img_file.append(wrem)
            print(wrem)
            index_num += 1
        except AttributeError:
            remove_list.append(index_num)
            index_num += 1
            pass
    for index in remove_list:
        del remy_links[index]
        del titles[index]

def image():

    reqs = (grequests.get(img) for img in img_file)
    resp = grequests.map(reqs)

    for response in resp:
        soup3 = bs(response.content, 'lxml')
        try:
            fileclass = soup3.find('div', class_= 'fullImageLink')
            filelink = fileclass.find('a', href = True)
            wrem = remy_url + filelink['href']
            img_jacket.append(wrem)
            print(wrem)
        except AttributeError:
            pass

linklist()
song_title()
jacket()

image()

Any help or suggestions are greatly appreciated. Thank you!

python
beautifulsoup
discord
discord.py
asked on Stack Overflow Jan 13, 2020 by Jaeil • edited Jan 13, 2020 by Harmon758

1 Answer

1

Do you import requests somewhere else before grequests is imported?
This is likely due to a known issue with grequests/gevent.

answered on Stack Overflow Jan 13, 2020 by Harmon758

User contributions licensed under CC BY-SA 3.0