--- a/admin/genericAgencyFixer.php
+++ b/admin/genericAgencyFixer.php
@@ -1,1 +1,44 @@
+get_db('disclosr-agencies');
+
+try {
+ $agencies = $db->get_view("app", "byCanonicalName", null, true)->rows;
+ //print_r($rows);
+ foreach ($agencies as $agency) {
+ //echo $agency->value->name . " ".$agency->value->website."
\n";
+ // print_r($agency);
+ //hasRestricitiveLicence" hasRestrictiveLicense -> has Restrictive Licence
+ // "hasYoutube" -> Tube
+ // "comment" -> "comments"
+ if (!isset($agency->value->metaTags) && isset($agency->value->website)) {
+ echo $agency->value->name . " ".$agency->value->website."
\n";
+ $agency->value->metaTags = Array();
+ $request = Requests::get($agency->value->website);
+ $html = phpQuery::newDocumentHTML($request->body);
+ phpQuery::selectDocument($html);
+ foreach (pq('meta')->elements as $meta) {
+ $tagName = $meta->getAttribute('name');;
+ $content = $meta->getAttribute('content');
+ if ($tagName != "") {
+echo "$tagName == $content
\n";
+ $agency->value->metaTags[$tagName] = $content;
+ }
+ }
+ //print_r($agency->value->metaTags);
+ $db->save($agency->value);
+ echo "