diff --git a/main.py b/main.py new file mode 100644 index 0000000000000000000000000000000000000000..be3f3c7db1a7ff61fbbad0e4a5314beed5b33284 --- /dev/null +++ b/main.py @@ -0,0 +1,33 @@ +#Script made to search for a specific word [search] in API. +#OBS: This script takes a long time to run. +import requests + +#The first learning_object begins at ID = 3 +id=3 + +NUM_OF_LEARNING_OBJECTS = 300000 +API_URL = 'https://api.portalmec.c3sl.ufpr.br/v1/learning_objects/' +ATTRIBUTE_FOR_SEARCH = 'name' + +search = input() + +while ( id<NUM_OF_LEARNING_OBJECTS ): + + try: + response = requests.get(API_URL+ str(id)) + data = response.json() + + if ( data[ATTRIBUTE_FOR_SEARCH].find(search) != -1 ): + print(data[ATTRIBUTE_FOR_SEARCH]) + + id+=1 + except: + id+=1 + +print("Finalizado") + + + + + +