| Conditions | 3 |
| Total Lines | 11 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | #!/usr/bin/python |
||
| 33 | def get_image(query): |
||
| 34 | params = {"tags": query} |
||
| 35 | response = requests.get("https://yande.re/post.json?", params=params) |
||
| 36 | result_list = response.json() |
||
| 37 | if not response.text: |
||
| 38 | return None, None |
||
| 39 | if not result_list: |
||
| 40 | return None, None |
||
| 41 | post = random.choice(result_list) |
||
| 42 | direct_link, page_link = post.get("file_url"), "https://yande.re/post/show/"+str(post.get("id")) |
||
| 43 | return direct_link, page_link |