كود البايثون اجده اسهل من الاكسيل لانه صفحة واحدة HTML تقوم بالبحث فيها CTRL+F
,وعملية سحب 1400 صفحة قد لا تستغرق 5دقائق
ممكن تعديل على الكود لاضافة المواضيع الجديدة
import requests
from bs4 import BeautifulSoup
import time, sys
sys.stdout.reconfigure(encoding='utf-8')
BASE = "https://www.officena.net/ib/forum/89-%D9%82%D8%B3%D9%85-%D8%A7%D9%84%D8%A3%D9%83%D8%B3%D9%8A%D8%B3-access/page"
headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"}
all_topics = []
#من صفحة 1 الى 50
for page in range(1, 50): # will stop when no topics found
url = f"{BASE}/{page}/"
print(f"Page {page}: {url}")
resp = requests.get(url, headers=headers, timeout=15)
if resp.status_code != 200:
print(f" ✗ Status {resp.status_code} — stopping")
break
soup = BeautifulSoup(resp.text, "html.parser")
# IPS forum topic links
topics = soup.select("a[data-ipshover-target]")
# fallback selector if above returns nothing
if not topics:
topics = soup.select("h4.ipsDataItem_title a, span.ipsType_break a")
if not topics:
print(" ✗ No topics found — stopping")
break
page_count = 0
for t in topics:
href = t.get("href", "")
title = t.get_text(strip=True)
if title and "/topic/" in href:
all_topics.append({"title": title, "url": href})
page_count += 1
print(f" → {page_count} topics (total: {len(all_topics)})")
if page_count == 0:
print(" ✗ No valid topics — stopping")
break
time.sleep(1)
print(f"\nTotal: {len(all_topics)}")
# Save HTML
rows = ""
for i, t in enumerate(all_topics):
bg = "#f0f5fc" if i % 2 == 0 else "#ffffff"
rows += f'<tr style="background:{bg}"><td>{i+1}</td><td><a href="{t["url"]}" target="_blank">{t["title"]}</a></td></tr>'
html = f"""<!DOCTYPE html>
<html dir="rtl" lang="ar">
<head><meta charset="UTF-8"><title>مواضيع أكسيس - أوفيسنا</title>
<style>
body {{ font-family: Arial; padding: 20px; background: #f4f6f9; }}
h2 {{ color: #1E3A5F; text-align: center; }}
.count {{ text-align: center; color: #555; margin-bottom: 16px; }}
table {{ width: 100%; border-collapse: collapse; background: white;
box-shadow: 0 2px 8px rgba(0,0,0,0.1); border-radius: 8px; overflow: hidden; }}
thead tr {{ background: #2E75B6; color: white; }}
th, td {{ padding: 10px 14px; text-align: right; font-size: 13px; border-bottom: 1px solid #e0e8f0; }}
tr:hover td {{ background: #d6e4f7 !important; }}
a {{ color: #2E75B6; text-decoration: none; }}
a:hover {{ text-decoration: underline; }}
</style>
</head>
<body>
<h2>📋 مواضيع قسم الأكسيس — أوفيسنا</h2>
<p class="count">إجمالي المواضيع: <strong>{len(all_topics)}</strong></p>
<table>
<thead><tr><th>#</th><th>عنوان الموضوع</th></tr></thead>
<tbody>{rows}</tbody>
</table>
</body></html>"""
with open("officena_access.html", "w", encoding="utf-8") as f:
f.write(html)
print("Saved → officena_access.html")