35 lines
859 B
Python
35 lines
859 B
Python
import sqlite3
|
|
|
|
conn = sqlite3.connect('content_automation.db')
|
|
cursor = conn.cursor()
|
|
|
|
# Get first tier2 article
|
|
cursor.execute('SELECT id FROM generated_content WHERE project_id=1 AND tier="tier2" LIMIT 1')
|
|
tier2_id = cursor.fetchone()[0]
|
|
|
|
# Count links by type
|
|
cursor.execute('''
|
|
SELECT link_type, COUNT(*)
|
|
FROM article_links
|
|
WHERE from_content_id=?
|
|
GROUP BY link_type
|
|
''', (tier2_id,))
|
|
|
|
print(f'Tier2 article {tier2_id} link counts:')
|
|
for row in cursor.fetchall():
|
|
print(f' {row[0]}: {row[1]}')
|
|
|
|
# Show the actual tiered links
|
|
cursor.execute('''
|
|
SELECT to_url, anchor_text
|
|
FROM article_links
|
|
WHERE from_content_id=? AND link_type="tiered"
|
|
''', (tier2_id,))
|
|
|
|
print(f'\nTiered links for article {tier2_id}:')
|
|
for i, row in enumerate(cursor.fetchall(), 1):
|
|
print(f' {i}. {row[1]} -> {row[0][:60]}...')
|
|
|
|
conn.close()
|
|
|