はてなキーワード: Errorとは
import requests import json from urllib.parse import quote def fetch_bookmarks(url): try: # URLをエスケープ escaped_url = quote(url, safe="") api_url = f"https://b.hatena.ne.jp/entry/json/?url={escaped_url}" response = requests.get(api_url) response.raise_for_status() try: return response.json() except json.decoder.JSONDecodeError as e: print(f"Error decoding JSON from {api_url}: {e}") print("Response content:", response.text) return [] except requests.exceptions.RequestException as e: print(f"Error fetching bookmarks from {api_url}: {e}") return [] def find_common_bookmarks(bookmarks1, bookmarks2, url1, url2): common_users = set(bm["user"] for bm in bookmarks1 if bm["comment"]) & set(bm["user"] for bm in bookmarks2 if bm["comment"]) common_bookmarks = [] for user in common_users: comments = [] for bm in bookmarks1: if bm["user"] == user and bm["comment"]: comments.append({"url": url1, "comment": bm["comment"], "timestamp": bm["timestamp"]}) break for bm in bookmarks2: if bm["user"] == user and bm["comment"]: comments.append({"url": url2, "comment": bm["comment"], "timestamp": bm["timestamp"]}) break if len(comments) == 2: common_bookmarks.append({"user": user, "comments": comments}) return common_bookmarks if __name__ == "__main__": url1 = "https://news.yahoo.co.jp/articles/f9966c4ccc374fc88babbb50175a9ea844c99638" url2 = "https://www.asahi.com/articles/ASN6K7F64N6KUJHB00L.html" data1 = fetch_bookmarks(url1) data2 = fetch_bookmarks(url2) common_bookmarks = find_common_bookmarks(data1["bookmarks"], data2["bookmarks"], url1, url2) print(json.dumps(common_bookmarks, indent=2, ensure_ascii=False))
url1, url2のところを対象としたいものに変えれば使えるよ
バグあったら直して使ってね
Description
Every web user has at least once encountered loss of internet connection. This happens for a variety of reasons, such as a dysfunction in the cellular network or a broken internet cable. However, regardless of the reason, every Google Chrome user sees the Dino game (when there is no internet) instead of a plain blank error page. This game can be played without an internet connection.
Play game: Dinosaur T-Rex Game
Despite the fact that the game is just a plain runner that’s built into the Google Chrome browser, the developers behind it still deserve a round of applause. The peculiar monochrome graphics and the simplicity make the game even better, and it has gained a lot of worldwide fans since its launch.
The main character of the game is a classic dinosaur, a Tyrannosaurus rex, the species we usually see in movies and books about dinosaurs. It’s a carnivorous type of dinosaur from the Cretaceous. In the game it runs through the desert, encountering pterodactyls and cactuses that need to be avoided by jumping or ducking. As the distance the dinosaur has traveled increases, so does its speed, which is why it’s quite difficult for an inexperienced player to get a high score, even though the game itself seems easy.
Surely, all of you are curious about the development of the Chrome Dinosaur Game Online, so let’s take a little trip back in time.
The development of the T-Rex game dates back to September 2014, however, the final improvements were completed only in December of that same year. The adjustments supported earlier versions of the Android operating system.
Sebastien Gabriel, one of the designers of the game, says that the T-rex was chosen as a funny reference to "prehistoric times", when highspeed internet wasn’t so widely spread.
The T-rex was also not an accidental choice. The offline Chrome Dino game (without internet) was also called "Project Bolan", referring to the popular singer Mark Bolan from the 70s band "T-Rex". While creating the game the programmers also thought about making Dino growl or kick. Eventually these features were rejected in order to keep the game simple and "prehistoric".
How to open the T-Rex Chrome Dino Game?
In order to open the game you can simply type chrome://dino/ in the address bar. The game will open even if you’re connected to the internet, so there’s no need to disconnect.
The majority of internet users have Chrome as their default browser. However, if you’re using a different one, our website can help. Here you can play the T-Rex Dinosaur Game using any browser and any device, like a desktop computer or even your cell phone.
このエントリは大逆罪のため削除されました