Quantcast
Channel: プログラミング
Viewing all articles
Browse latest Browse all 8482

あれ?iOS18で仕様変化されている!と驚いたので影響範囲を調べる。 - Citrus-Field TECH BLOG.

$
0
0

もちろんローテクなWebスクレイピングで。

PythonのBeautifulSoup ライブラリを使用します。

pip install requests beautifulsoup4

code:

import requests from bs4 import BeautifulSoup

def fetch_ios18_articles(): base_url = "https://developer.apple.com/documentation/" response = requests.get(base_url)

if response.status_code != 200:
    print("Failed to fetch the documentation page.")
    return []

soup = BeautifulSoup(response.content, "html.parser")
articles = []

# Extract all links from the documentation homepage
for link in soup.find_all("a", href=True):
    url = link["href"]
    title = link.get_text(strip=True)

    # Filter for links containing "iOS 18+" in the text
    if "iOS 18+" in title:
        full_url = url if url.startswith("http") else f"https://developer.apple.com{url}"
        articles.append({"title": title, "url": full_url})

return articles

Fetch articles and print results

articles = fetch_ios18_articles()

if articles: print("Found the following articles with 'iOS 18+':") for article in articles: print(f"- {article['title']}: {article['url']}") else: print("No articles with 'iOS 18+' found.")


Viewing all articles
Browse latest Browse all 8482

Trending Articles