{"id":22724540,"url":"https://github.com/binghuan/ptt","last_synced_at":"2025-08-24T15:10:07.091Z","repository":{"id":25234720,"uuid":"28659276","full_name":"binghuan/ptt","owner":"binghuan","description":null,"archived":false,"fork":false,"pushed_at":"2025-07-31T10:48:31.000Z","size":937,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"gh-pages","last_synced_at":"2025-07-31T14:18:49.636Z","etag":null,"topics":["javascript","webapp"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/binghuan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-31T07:15:22.000Z","updated_at":"2025-07-31T10:48:35.000Z","dependencies_parsed_at":"2022-08-23T22:00:38.285Z","dependency_job_id":null,"html_url":"https://github.com/binghuan/ptt","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/binghuan/ptt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binghuan%2Fptt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binghuan%2Fptt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binghuan%2Fptt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binghuan%2Fptt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/binghuan","download_url":"https://codeload.github.com/binghuan/ptt/tar.gz/refs/heads/gh-pages","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binghuan%2Fptt/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269805528,"owners_count":24477992,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","webapp"],"created_at":"2024-12-10T15:07:02.437Z","updated_at":"2025-08-10T23:33:35.586Z","avatar_url":"https://github.com/binghuan.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# PTT Web Application\n\nA web application for browsing PTT (批踢踢實業坊), Taiwan's largest bulletin board system. This application provides a mobile-friendly interface to access PTT content including hot boards, article lists, and individual articles.\n\n## Features\n\n- **Hot Boards**: View trending/popular PTT boards\n- **Article Lists**: Browse articles within specific boards with pagination support\n- **Article Content**: Read individual PTT articles with full content\n- **Mobile Responsive**: Optimized for mobile devices using jQuery Mobile\n- **Favorite Boards**: Save and manage favorite boards locally\n- **Comment System**: Post comments via MongoDB integration\n- **Cross-Origin Support**: CORS enabled for API access\n\n## Technology Stack\n\n- **Backend**: Node.js with Express.js framework\n- **Frontend**: HTML5, CSS3, JavaScript with jQuery Mobile\n- **Database**: MongoDB (via MongoLab)\n- **Web Scraping**: Cheerio for HTML parsing\n- **Character Encoding**: iconv-lite for Big5 encoding support\n- **Template Engine**: Jade and EJS\n\n## Installation\n\n1. Clone the repository:\n```bash\ngit clone \u003crepository-url\u003e\ncd ptt\n```\n\n2. Install dependencies:\n```bash\nnpm install\n```\n\n3. Start the application:\n```bash\nnpm start\n# or\nnode bin/www\n```\n\nThe application will run on http://localhost:8080\n\n## API Endpoints\n\n### Public Routes\n- `GET /` - Main application interface\n- `GET /api/hotboard` - Get list of hot/trending boards\n- `GET /api/articlelist/:url/:page` - Get article list for a specific board\n- `GET /api/article/:url` - Get individual article content\n\n### Comment System\n- `POST /smo/comment` - Submit a comment (requires MongoDB connection)\n\n## Project Structure\n\n```\n├── app.js              # Main Express application\n├── package.json        # Dependencies and scripts\n├── bin/www            # Application server startup\n├── routes/            # Express route handlers\n│   ├── index.js       # Main page route\n│   ├── users.js       # API routes for PTT data\n│   ├── smo.js         # Comment system routes\n│   └── fetch.js       # PTT web scraping logic\n├── views/             # HTML templates\n│   ├── index.html     # Main application page\n│   ├── pttBoards.html # Board listing page\n│   └── pttView.html   # Article view page\n├── public/            # Static assets\n│   ├── javascripts/   # Client-side JavaScript\n│   ├── stylesheets/   # CSS files\n│   └── icon/          # Application icons\n└── driver.js          # MongoDB connection test\n```\n\n## Configuration\n\n### MongoDB Setup\nThe application uses MongoDB for the comment system. Update the connection string in `routes/smo.js`:\n\n```javascript\nvar db = yield MongoClient.connect('mongodb://username:password@host:port/database');\n```\n\n### Port Configuration\nDefault port is 8080. Set the `PORT` environment variable to change:\n\n```bash\nPORT=3000 npm start\n```\n\n## Development\n\n### Running Tests\n```bash\nnode test_rest.js\n```\n\n### Database Testing\n```bash\nnode driver.js\n```\n\n## Features Overview\n\n### Web Scraping\n- Fetches data from PTT's web interface\n- Handles Big5 character encoding\n- Parses HTML using Cheerio\n- Supports pagination for article lists\n\n### Mobile Interface\n- jQuery Mobile for responsive design\n- Touch-friendly navigation\n- Offline capability with application cache\n- Custom icons for various device sizes\n\n### Data Management\n- Local storage for favorite boards\n- JSON API responses\n- Cross-origin resource sharing (CORS)\n\n## Browser Support\n\n- Modern mobile browsers (iOS Safari, Android Chrome)\n- Desktop browsers with mobile viewport\n- Requires JavaScript enabled","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinghuan%2Fptt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbinghuan%2Fptt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinghuan%2Fptt/lists"}