Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Facebook Page Categories

All of the categories!

I wrote a really simple JavaScript script that uses jQuery to extract all the categories from Facebook's "Create a page" page.

Instructions

  1. Navigate to the Create a page page.
  2. jQuerify the page.
  3. Open up your JavaScript console of choice and run the following script:
(function () {
  var categories = {};

  // Get the value/text of each category <option> on the page
  $jq("select[name=category] option").each(function () {
    categories[$jq(this).val()] = $jq(this).text();
  });

  // Delete the "Choose a category" default option
  delete categories["0"];

  // Print a JSON string of all the categories
  return JSON.stringify(categories);
})();
1103 Actor/Director
1105 Movie
1108 Producer
1109 Writer
1110 Studio
1111 Movie Theater
1112 TV/Movie Award
1113 Fictional Character
1200 Album
1201 Song
1202 Musician/Band
1204 Musical Instrument
1206 Playlist
1207 Music Video
1208 Concert Tour
1209 Concert Venue
1210 Radio Station
1211 Record Label
1212 Music Award
1213 Music Chart
1300 Book
1301 Author
1305 Book Store
1306 Library
1307 Magazine
1308 Editor
1400 TV Show
1402 TV Network
1404 TV Channel
1600 Athlete
1601 Artist
1602 Public Figure
1604 Journalist
1605 News Personality
1606 Chef
1607 Lawyer
1608 Doctor
1609 Business Person
1610 Comedian
1611 Entertainer
1612 Monarch
1613 Teacher
1614 Dancer
1700 Politician
1701 Government Official
1800 Sports League
1801 Professional Sports Team
1802 Coach
1803 Amateur Sports Team
1804 School Sports Team
1900 Restaurant/Cafe
2100 Bar
2101 Club
2200 Company
2201 Product/Service
2202 Website
2205 Cars
2206 Bags/Luggage
2208 Camera/Photo
2209 Clothing
2210 Computers
2211 Software
2212 Office Supplies
2213 Electronics
2214 Health/Beauty
2215 Appliances
2216 Building Materials
2217 Commercial Equipment
2218 Home Decor
2219 Furniture
2220 Household Supplies
2221 Kitchen/Cooking
2222 Patio/Garden
2223 Tools/Equipment
2224 Wine/Spirits
2226 Jewelry/Watches
2227 Movies/Music
2230 Pet Supplies
2231 Outdoor Gear/Sporting Goods
2232 Baby Goods/Kids Goods
2233 Media/News/Publishing
2234 Bank/Financial Institution
2235 Non-Governmental Organization (NGO)
2236 Insurance Company
2237 Small Business
2238 Energy/Utility
2239 Retail and Consumer Merchandise
2240 Automobiles and Parts
2241 Industrials
2242 Transport/Freight
2243 Health/Medical/Pharmaceuticals
2244 Aerospace/Defense
2245 Mining/Materials
2246 Farming/Agriculture
2247 Chemicals
2248 Consulting/Business Services
2249 Legal/Law
2250 Education
2251 Engineering/Construction
2252 Food/Beverages
2253 Telecommunication
2254 Biotechnology
2255 Computers/Technology
2256 Internet/Software
2258 Travel/Leisure
2260 Community Organization
2261 Political Organization
2262 Vitamins/Supplements
2263 Drugs
2264 Church/Religious Organization
2300 Games/Toys
2301 App
2500 Local Business
2501 Hotel
2503 Landmark
2505 Transit Stop
2506 Airport
2507 Sports Venue
2508 Arts/Entertainment/Nightlife
2509 Automotive
2510 Spas/Beauty/Personal Care
2511 Event Planning/Event Services
2512 Bank/Financial Services
2513 Food/Grocery
2514 Health/Medical/Pharmacy
2515 Home Improvement
2516 Pet Services
2517 Professional Services
2518 Business Services
2519 Community/Government
2520 Real Estate
2521 Shopping/Retail
2522 Public Places
2523 Attractions/Things to Do
2524 Sports/Recreation/Activities
2525 Tours/Sightseeing
2526 Transportation
2527 Hospital/Clinic
2528 Museum/Art Gallery
2600 Organization
2601 School
2602 University
2603 Non-Profit Organization
2604 Government Organization
2606 Cause
2618 Political Party
{
"1103":"Actor/Director",
"1105":"Movie",
"1108":"Producer",
"1109":"Writer",
"1110":"Studio",
"1111":"Movie Theater",
"1112":"TV/Movie Award",
"1113":"Fictional Character",
"1200":"Album",
"1201":"Song",
"1202":"Musician/Band",
"1204":"Musical Instrument",
"1206":"Playlist",
"1207":"Music Video",
"1208":"Concert Tour",
"1209":"Concert Venue",
"1210":"Radio Station",
"1211":"Record Label",
"1212":"Music Award",
"1213":"Music Chart",
"1300":"Book",
"1301":"Author",
"1305":"Book Store",
"1306":"Library",
"1307":"Magazine",
"1308":"Editor",
"1400":"TV Show",
"1402":"TV Network",
"1404":"TV Channel",
"1600":"Athlete",
"1601":"Artist",
"1602":"Public Figure",
"1604":"Journalist",
"1605":"News Personality",
"1606":"Chef",
"1607":"Lawyer",
"1608":"Doctor",
"1609":"Business Person",
"1610":"Comedian",
"1611":"Entertainer",
"1612":"Monarch",
"1613":"Teacher",
"1614":"Dancer",
"1700":"Politician",
"1701":"Government Official",
"1800":"Sports League",
"1801":"Professional Sports Team",
"1802":"Coach",
"1803":"Amateur Sports Team",
"1804":"School Sports Team",
"1900":"Restaurant/Cafe",
"2100":"Bar",
"2101":"Club",
"2200":"Company",
"2201":"Product/Service",
"2202":"Website",
"2205":"Cars",
"2206":"Bags/Luggage",
"2208":"Camera/Photo",
"2209":"Clothing",
"2210":"Computers",
"2211":"Software",
"2212":"Office Supplies",
"2213":"Electronics",
"2214":"Health/Beauty",
"2215":"Appliances",
"2216":"Building Materials",
"2217":"Commercial Equipment",
"2218":"Home Decor",
"2219":"Furniture",
"2220":"Household Supplies",
"2221":"Kitchen/Cooking",
"2222":"Patio/Garden",
"2223":"Tools/Equipment",
"2224":"Wine/Spirits",
"2226":"Jewelry/Watches",
"2227":"Movies/Music",
"2230":"Pet Supplies",
"2231":"Outdoor Gear/Sporting Goods",
"2232":"Baby Goods/Kids Goods",
"2233":"Media/News/Publishing",
"2234":"Bank/Financial Institution",
"2235":"Non-Governmental Organization (NGO)",
"2236":"Insurance Company",
"2237":"Small Business",
"2238":"Energy/Utility",
"2239":"Retail and Consumer Merchandise",
"2240":"Automobiles and Parts",
"2241":"Industrials",
"2242":"Transport/Freight",
"2243":"Health/Medical/Pharmaceuticals",
"2244":"Aerospace/Defense",
"2245":"Mining/Materials",
"2246":"Farming/Agriculture",
"2247":"Chemicals",
"2248":"Consulting/Business Services",
"2249":"Legal/Law",
"2250":"Education",
"2251":"Engineering/Construction",
"2252":"Food/Beverages",
"2253":"Telecommunication",
"2254":"Biotechnology",
"2255":"Computers/Technology",
"2256":"Internet/Software",
"2258":"Travel/Leisure",
"2260":"Community Organization",
"2261":"Political Organization",
"2262":"Vitamins/Supplements",
"2263":"Drugs",
"2264":"Church/Religious Organization",
"2300":"Games/Toys",
"2301":"App",
"2500":"Local Business",
"2501":"Hotel",
"2503":"Landmark",
"2505":"Transit Stop",
"2506":"Airport",
"2507":"Sports Venue",
"2508":"Arts/Entertainment/Nightlife",
"2509":"Automotive",
"2510":"Spas/Beauty/Personal Care",
"2511":"Event Planning/Event Services",
"2512":"Bank/Financial Services",
"2513":"Food/Grocery",
"2514":"Health/Medical/Pharmacy",
"2515":"Home Improvement",
"2516":"Pet Services",
"2517":"Professional Services",
"2518":"Business Services",
"2519":"Community/Government",
"2520":"Real Estate",
"2521":"Shopping/Retail",
"2522":"Public Places",
"2523":"Attractions/Things to Do",
"2524":"Sports/Recreation/Activities",
"2525":"Tours/Sightseeing",
"2526":"Transportation",
"2527":"Hospital/Clinic",
"2528":"Museum/Art Gallery",
"2600":"Organization",
"2601":"School",
"2602":"University",
"2603":"Non-Profit Organization",
"2604":"Government Organization",
"2606":"Cause",
"2618":"Political Party"
}
@nuc

This comment has been minimized.

Copy link

nuc commented Aug 9, 2012

lovely!

@bondt

This comment has been minimized.

Copy link

bondt commented May 17, 2013

Easy enough! :-)

@tungle

This comment has been minimized.

Copy link

tungle commented Aug 20, 2013

Tks for the tool, are the pairs changed over time? say it's always <2618, Political Party>?

@unprolix

This comment has been minimized.

Copy link

unprolix commented Aug 28, 2013

Without jQuery it's about as easy:

function get_categories() {
    var result = {};
    var options = document.getElementsByTagName('option');
    for (var i=0; i < options.length; i++) {
        var obj = options[i];
        if (obj.parentNode.id == 'category' && obj.value != '0')
            result[obj.value] = obj.innerHTML;
    };
    return result;
}
@danakianfar

This comment has been minimized.

Copy link

danakianfar commented Apr 3, 2014

jQuerify doesn't seem to work in latest updates of Chrome or Firefox due to security restrictions. Can anyone confirm? Am I missing something?

@ghost

This comment has been minimized.

Copy link

ghost commented Nov 14, 2014

dkianfar, just run the function above you and it will return you everything you need!

@Canabaz

This comment has been minimized.

Copy link

Canabaz commented Jun 18, 2017

How can this be adapted for another website?

Eg:
Give

@Canabaz

This comment has been minimized.

Copy link

Canabaz commented Jun 18, 2017

How can this be adapted for another website?

Eg:
Given a website that has multiple product category,
When I run a variation of this script,
Then a json containing the product category will be generated,
And the category will also contain all child categories.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.